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

Re: deleting files



On Tue, Nov 23, 1999 at 05:00:01PM +1300, zdrysdal@diagnostic.co.nz wrote:
> Hi
> 
> does anyone happen to know of a quicker way of deleting 40000 files out of
> a directory other than the command "find . -exec rm {} \;"
> 
> will rm -r <directory> be as quick?

It will actually be much quicker (you may need to add a -f option as
others pointed out).  The find command will start the rm command for
each file separately, so you will run rm 40000 times instead of one
time.  If you need `find' to select files on specific criteria, like
name, user, or date, you should use it together with xargs:

find . -name \*.tmp -print | xargs rm -f {} \;

This will start rm the minimum amount of times with maximum length
command lines.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)


Reply to: