Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread Jerry

well, the way i was thinking it could be done would probably take longer
than typing rm mp31.mp3... rm mp32.mp3 lol  does xmms's playlist let you
rename files?  oh... that'd be another way.

first idea was a regex script but unless it's mostly from one or two
groups/albums it'd be more work than it's worth.. but if you had a playlist
editor that let you rename them (by file, not by tag) like SpR Jukebox
(unfortunately, just an mIRC script.. win98) you could batch name the ones
you didn't want into something similar like done1-500.mp3 and rm done*.mp3.


- Original Message -
From: Kirtis B [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, May 19, 2002 9:57 AM
Subject: [newbie] deleting files = 500k on the command line


 The subject says it all.  I have a bunch of unfinished Mp3's that i want
to
 clear out but i don't know how to string together the nessecary commands
to
 get it done.

 Thanks,
 KIRT
 --
 Where'd you get your CPU, a box of Crackerjacks!?
  -Wierd Al








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





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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread Damian G

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 


uhm... does it HAVE to be a command-line method?

from konqueror you could just sort the files up by size and select
from the smallest file on the directory, all the way up to 500kb files,
and push the 'delete' key..?

Damian



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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread H. Narfi Stefansson

On Sunday 19 May 2002 18:46, Damian G wrote:
 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

You want to find the all the mp3 files that satisfy a criteria and delete 
them, right? Well, find is your friend:

find . -name *.mp3
will list all files named *.mp3 that exist in . (i.e. the current 
directory) or any subdirectory of .
Now what about the size requirement? I had a quick look at the man-page 
and became wiser:

find . -name *.mp3 -a -size -512k

The -a stands for and, the -512k stands for less than 512k.
Now all we need is to delete these files:
You can do that with find, but I find it much simpler to pipe the search 
results from find into xargs:

find . -name *.mp3 -a -size -512k | xargs /bin/rm

and this will run the /bin/rm command on the output from find, i.e. delete 
all the files that find returned from the search.

Of course you have to be darn careful about this -- make sure you don't 
accidentally delete all your mp3 files! Check the output from find first, 
then append the | xargs /bin/rm part.

Narfi.



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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread Todd Slater

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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread FemmeFatale

Jerry wrote:
 
 well, the way i was thinking it could be done would probably take longer
 than typing rm mp31.mp3... rm mp32.mp3 lol  does xmms's playlist let you
 rename files?  oh... that'd be another way.
 
 first idea was a regex script but unless it's mostly from one or two
 groups/albums it'd be more work than it's worth.. but if you had a playlist
 editor that let you rename them (by file, not by tag) like SpR Jukebox
 (unfortunately, just an mIRC script.. win98) you could batch name the ones
 you didn't want into something similar like done1-500.mp3 and rm done*.mp3.
 
 - Original Message -
 From: Kirtis B [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, May 19, 2002 9:57 AM
 Subject: [newbie] deleting files = 500k on the command line
 
  The subject says it all.  I have a bunch of unfinished Mp3's that i want
 to
  clear out but i don't know how to string together the nessecary commands
 to
  get it done.
 
  Thanks,
  KIRT
  --
  Where'd you get your CPU, a box of Crackerjacks!?
   -Wierd Al
 
 
 
I use XMMS to delete mass files eomtimes

Just highlight a bunch by holding down shift, then *Delete Permanently*
I believe is an option.  It is in winamp for sure. :)

on the CLI I don't know how to do that either other than if they were
named say... whatever1.mp3, whatever2.mp3.

then just do a rm -f whatever*.mp3

-- 
Femme

Good Decisions You boss Made:

We'll do as you suggest and go with Linux.  I've always liked that
character from Peanuts.

- Source: Dilbert




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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread FemmeFatale

Damian G wrote:
 
 On Sun, 19 May 2002 17:36:28 -0400

 
 uhm... does it HAVE to be a command-line method?
 
 from konqueror you could just sort the files up by size and select
 from the smallest file on the directory, all the way up to 500kb files,
 and push the 'delete' key..?
 
 Damian


Not much of a learning experience though is it Damian? :)

Give him Kudos for trying to use the CLI :)  I do

-- 
Femme

Good Decisions You boss Made:

We'll do as you suggest and go with Linux.  I've always liked that
character from Peanuts.

- Source: Dilbert




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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread Kirtis B

Thanks, that worked beautifully.

and to Damian..  I like to avoid using Konquerer because:

1. It runs slowly
2. The CL is faster if you know how to use it.
3. I sometimes end up without the luxury of X... so i like to know how to get 
along without it.  

KIRT

On Sunday 19 May 2002 07:46 pm, you wrote:
 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

 uhm... does it HAVE to be a command-line method?

 from konqueror you could just sort the files up by size and select
 from the smallest file on the directory, all the way up to 500kb files,
 and push the 'delete' key..?

 Damian

-- 
Where'd you get your CPU, a box of Crackerjacks!?
 -Wierd Al



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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread Damian G

On Sun, 19 May 2002 23:23:06 -0400
Kirtis B [EMAIL PROTECTED] wrote:

 Thanks, that worked beautifully.
 
 and to Damian..  I like to avoid using Konquerer because:
 
 1. It runs slowly
 2. The CL is faster if you know how to use it.
 3. I sometimes end up without the luxury of X... so i like to know how to get 
 along without it.  
 
 KIRT


well, you are right, konq is much slower than... ... ... pretty much anything else,
i was just thinking about the simplest solution possible.

see ya.

Damian



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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread dfox

 1. It runs slowly

Particularly, as it gives visual confirmation of files being deleted,
moved, or what have you. In the case of deletes, it'll have to blank
out all the icons representing the deleted file(s) and move other icons
up as it rescans the directory.

 2. The CL is faster if you know how to use it.

Most definitely. And this particular example is not readily programmable
by Konqueror or any other gui directory browser I know of. You can 
facilitate it somewhat by sorting (at least by size) so you don't have to
hunt all over the disk to find files that match the criteria).

 3. I sometimes end up without the luxury of X... so i like to know how to get 
Indeed. But yuo can use xterm/konsole/what have you as well as Konqueror
in day to day use. Both have advantages. For casual ad hoc file maintenance,
Konqueror is probably easier since all you need do is right click the icon 
usually. But for real work, nothing beats working in the shell, and the
OP's situation shell is going to be a win.  




 






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



Re: [newbie] deleting files = 500k on the command line

2002-05-19 Thread dfox

 on the CLI I don't know how to do that either other than if they were
 named say... whatever1.mp3, whatever2.mp3.

Use 'find'. i.e.

# find . -name *.mp3 and then do whatever else yuu need. For instance,
-size 500 would select (AFAIK) files 500K and over in length. Then just
pass that over to rm with either xargs or backticks/braces.

rm -f ${find -name *.mp3 -size 500}

Remember that whatever filenames 'find' finds are replaced literally
on the command line, so it becomes 'rm -f file1.mp3 file2.mp3 ' etc. If
you have a lot of files, this might fail, although there's plenty of
room for command lines in Linux; somewhere around 78K IIRC.

 Femme





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