Re: piping to rm?


Subject: Re: piping to rm?
eclectric@ftml.net
Date: Wed Feb 05 2003 - 08:29:56 AKST


On Wed, 5 Feb 2003 06:57:01 -0900, bryan@ak.net said:
> On Wed, Feb 05, 2003 at 06:50:05AM -0900, AFABCO <lee@afabco.com> wrote:
> >
> > I'm wanting to go thru and delete all my mp3's avi's, mpg's, etc...
>
> find . -iname *.mp3 |xargs rm
> should work.

or a better way, since whitespace causes problems on occasion:
  find . -iname *.mp3 -print0 | xargs -0 rm

This pads the filenames (for both programs) with null characters, rather
than spaces, which will catch stuff like "(Wolfe Tones) Black and
Tans.mp3", which would otherwise be seen as 5 non-existant files by
xargs. Or go with the -exec tag for find as has already been suggested.

James

-- 
http://fastmail.fm - Choose from over 50 domains or use your own

--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Feb 05 2003 - 08:30:04 AKST