From owner-freebsd-questions@FreeBSD.ORG Mon Jan 2 17:59:16 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD65D16A41F for ; Mon, 2 Jan 2006 17:59:16 +0000 (GMT) (envelope-from kruptos@mlinux.org) Received: from ms-smtp-03.tampabay.rr.com (ms-smtp-03-smtplb.tampabay.rr.com [65.32.5.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1313443D46 for ; Mon, 2 Jan 2006 17:59:14 +0000 (GMT) (envelope-from kruptos@mlinux.org) Received: from fnord.quux.edu (103.114.33.65.cfl.res.rr.com [65.33.114.103]) by ms-smtp-03.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id k02HxAGK021011; Mon, 2 Jan 2006 12:59:11 -0500 (EST) From: Kevin Brunelle To: freebsd-questions@freebsd.org Date: Mon, 2 Jan 2006 12:59:08 -0500 User-Agent: KMail/1.8.3 References: <20060102171456.25239.qmail@web86911.mail.ukl.yahoo.com> <43B961C4.8020505@mykitchentable.net> In-Reply-To: <43B961C4.8020505@mykitchentable.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601021259.09740.kruptos@mlinux.org> X-Virus-Scanned: Symantec AntiVirus Scan Engine Cc: Drew Tomlinson Subject: Re: Find Syntax X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2006 17:59:16 -0000 > OK, I understand now. I ultimately want to delete files and was just > trying to check my command before doing the actual delete. I will use > '-ls' in my script. > > >find . -type f -mtime +1w -exec ls -l {} \; > > This works too. Thanks again! What is your intent with the -ls? Do you need the full listing because I find that if I just want to know what files are removed the "-print" switch is cleaner. Or, once I am comfortable that the command is doing what I want, leaving off the output entirely. For my temp file deletions I use /usr/bin/find /home/kevinb/tmp -atime +3 -exec rm {} \; Yes, I keep my own tmp/ directory below my home directory (it's an old habit). This command deletes anything I haven't accessed in three or more days. I use access (-atime) here but modification works just as well. I have that in a script which cron runs once a day so I can use my temporary folder and not worry about cleaning up after myself... and I know that anything I put there I expect to lose unless I find a reason to keep it and move it somewhere else. As a word of warning, don't run this in your home directory or in a location where there are files which will sit around without being used for months at a time. You would really be upset if ~/.cshrc happened to vanish or any other file you rely on but don't think of. -Kevin