[TriLUG] find and rm command

Dan trilug at daijin.nulluser.com
Thu Jul 15 15:53:14 EDT 2004


--On Thursday, July 15, 2004 03:15:24 PM -0400 Nathan Conrad 
<conrad at bungled.net> wrote:

> You need a semicolon at the end:
>
> find /home/directory/ -name thumbs.db -exec rm -rf {} \;
>
> Be careful with -rf. You should only need the -f in this case.

Agree with the caution on the '-r'... xargs works well for something like 
this as well:

	find /home/directory/ -name thumbs.db | xargs -t rm

The '-t' to xargs let's you see the command roll by.  In this case it is 
probably not really helpful but I have had instances where I had to find 
and delete 1000's of files.  It is noticeably faster to use xargs and call 
rm with a long command line rather than call rm for the files one by one.

-- 
Dan



More information about the TriLUG mailing list