[GLLUG] using find and xargs to remove files

Alec Warner warnera6 at egr.msu.edu
Tue Apr 4 21:02:56 EDT 2006


Dustin Clute wrote:
> You could of also done the following.
> 
> 
# find /  -type f -name Thumbs.db -exec rm {} \;
Not as good because for N files the -exec will spawn N rm's
xargs is smart enough to stuff as many files as it can on the command 
line when invoking rm.

> 
> 
> Dustin
> 
> On 4/3/06, *Caleb Cushing* <xenoterracide at gmail.com 
> <mailto:xenoterracide at gmail.com>> wrote:
> 
>     I'm trying to remove the crappy remnants of windows on my linux box.
>     one thing I want to get rid of is the Thumbs.db and desktop.ini
>     files that were in my music folder and got copied over. I was trying
>     to do it by piping find to xargs but that isn't working. It should
>     and I'm trying to figure out why it isn't. I know I could just use
>     the -exec option  but now I just want to know why what I'm trying to
>     do isn't working.
> 
>              # find / -name "Thumbs.db" | xargs rm
> 
>     according to this
>     http://www.unixreview.com/documents/s=8274/sam0306g/ that should
>     work...
>     I've tried variations
> 
>              #find / -type f -name "Thumbs.db" -print | xargs rm
> 
>     and all sorts of other things. I usually get this
> 
>               xargs: unmatched single quote
> 
>     I looked the error up and what I found was of no help. at least to
>     me... I didn't get it. Can someone tell me what I am doing wrong and
>     how to do it properly?
> 
> 
> 
>     _______________________________________________
>     linux-user mailing list
>     linux-user at egr.msu.edu <mailto:linux-user at egr.msu.edu>
>     http://mailman.egr.msu.edu/mailman/listinfo/linux-user
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user



More information about the linux-user mailing list