[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Delete 4 million files



On Wed, Mar 25, 2009 at 10:19:37AM +0100, Rainer Kluge wrote:
> Tapani Tarvainen schrieb:
> >> kj wrote:
> > 
> >>> Now, I've been running the usual find . -type f -exec rm {} \;
> >>> but this is going at about 700,000 per day.  Would simply doing an rm  
> >>> -rf on the Maildir be quicker?  Or is there a better way?
> > 
> > While rm -rf would certainly be quicker and is obviously preferred
> > when you want to remove everything in the directory, the find version
> > could be speeded significantly by using xargs, i.e.,
> > find . -type f -print0 | xargs -0 rm
> > This is especially  useful if you want to remove files selecticely
> > instead of everything at once.
> > 
> 
> This exact solution has been proposed just one week ago in this same thread by
> Rob Starling

And this requires traversing the directory not just a single time but 4
milion times (once per rm process). Not to mention merely spawning 4
milion such processes is not fun (but spawning those would probably fit
nicely within 10 minutes or so)

-- 
Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
ICQ# 16849754         |                    | friend


Reply to: