[NTLUG:Discuss] Removing lots of Files - help.

kbrannen@gte.net kbrannen at gte.net
Sun Apr 6 14:53:09 CDT 2003


Victor Brilon wrote:
> find /full/path/to/dir -name '*~' -exec rm -i {} \;
> 
> Obviously change the path to be the full path to where you want to start 
> looking. And get rid of the '-i' if you're feeling brave and don't want 
> confirmation of every file you nuke :)

And if you don't want the "-i" and also want it to run faster, change it to:

find /full/path/to/dir -name '*~' -print | xargs rm

and it will run *much* faster than if you use "-exec" in the find command. 
More specifically...  For a small number of files, you won't notice a speed 
difference, but if you have more than about 50 files, the speed difference is 
significant. :-)

HTH,
Kevin




More information about the Discuss mailing list