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

Joel Sinor jsinor at comcast.net
Sun Apr 6 16:12:00 CDT 2003


xargs works too, and is a good command to remember for things that do not have a built-in exec as find.  So

find / -name '*~' | xargs rm -f

would work as well.  One I use a lot is 

find /somedirectory -name "somepattern" | xargs grep somepattern

which searches all the files in that directory that match a pattern in the filename and greps them for a pattern in the content.  I usually leave out the -name part when I just want to search *all files* for something.  find is great if you just want a list of files with full paths that you want to do something to.

On Sun, 06 Apr 2003 15:22:35 -0500 (CDT)
Bobby Sanders <ssanders at vzinet.com> wrote:

> Thanks David.
> 
> I don't to a _lot_ of administration, completely forgot about the exec
> switch and was too dumb to think about doing man find. Yuk.
> 
> Thanks again.
> 
> Bobby
> 
> --On Sun, 06 Apr 2003 13:49:33 -0500, David Camm <dcamm at advwebsys.com> said:
> 
>   DC> find / -name '*~' -exec rm -f {} \;
> 
> Bobby Sanders wrote:
>   >> I want to remove all of the files on my system which end in
>   >> tilde, ~.  I'm running bash, know this should be easy, have read
>   >> lots of Cameron's book, which I love, but can't put my finger on
>   >> this.
>   >> 
>   >> Help please.  Thanks.
> 
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss



More information about the Discuss mailing list