On Sun, 19 May 2002 17:36:28 -0400
Kirtis B <[EMAIL PROTECTED]> wrote:

> I was hoping that it'd be something simpler than that.  For example
> could i use ls grep and rm together to search for all the files that end
> in .mp3 and are less than 500k and then delete them? I'm certain there
> is a way to do this, i just don't really know how to string the commands
> together properly and i don't want to accidently delete my entire mp3
> collection. =)
> 
> KIRT 

Hi,

You could do a find, then pass the results on to rm:

find /path -type f -iname '*.mp3' -size -500k | xargs rm

If you have spaces in your filenames, though, that can be a problem. I'd
write the results of find to a file:

find /path -type f -iname '*.mp3' -size -500k > deletelist

then read the lines and remove each file (don't know if you can do this as
a one-liner):

#!/bin/bash
for mp3 in `cat deletelist`
do
rm $mp3
done
exit

HTH,
Todd

-- 
Todd Slater
The chief reason for going to school is to get the impression fixed for
life that there is a book side for everything. (Robert Frost)

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to