[K12OSN] OT: Scripting Question

Les Mikesell les at futuresource.com
Thu Nov 30 16:47:30 UTC 2006


On Thu, 2006-11-30 at 17:42 +0100, Nils Breunese wrote:

> >>> find /FOLDERNAME -type f -mtime +30 -exec rm -f {} ';'
> >>
> >> Fun trivia: xargs is faster than -exec'ing on every file. It will  
> >> delete
> >> the files together with one invocation of "rm" (or in optimally sized
> >> chunks if you're deleting _lots_ of files):
> >>
> >> find /FOLDERNAME -type -f -mtime +30 -print0 | xargs -0 rm -f
> >
> > Oops:
> >
> > find /FOLDERNAME -type f -mtime +30 -print0 | xargs -0 rm -f
> 
> I don't see the difference. Is it me?

-type f instead of -type -f.
When I run this kind of command from the command line I'd first try
find /FOLDERNAME -type f -mtime +30 -print
and look at the list, using control-C to stop if it is too long,
then if it looks like the right list of file, hit up-arrow to
recall the command and add the rest of it to actually do the rm's.

-- 
  Les Mikesell
   les at futuresource.com







More information about the K12OSN mailing list