Date: Mon, 2 Jan 2006 12:59:08 -0500 From: Kevin Brunelle <kruptos@mlinux.org> To: freebsd-questions@freebsd.org Cc: Drew Tomlinson <drew@mykitchentable.net> Subject: Re: Find Syntax Message-ID: <200601021259.09740.kruptos@mlinux.org> In-Reply-To: <43B961C4.8020505@mykitchentable.net> References: <20060102171456.25239.qmail@web86911.mail.ukl.yahoo.com> <43B961C4.8020505@mykitchentable.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601021259.09740.kruptos>