Web Hosting Talk







View Full Version : rm command help


Dedicated
04-17-2002, 07:01 PM
If I try to delete too many files, I get :

bash: /bin/rm: Argument list too long

I use rm -f *

SPaReK
04-17-2002, 07:17 PM
Try:

rm -f `ls | head`

a few times. That should delete the first 10 files in the directory each time you issue the command. You can change the number of files it deletes each time by using the -n parameter for head:

rm -f `ls | head -n 100`

would delete the first 100 files in the directory. Then after you have done that a few times, try:

rm -f *

and see if it will work then.

bitserve
04-17-2002, 10:07 PM
You can always use find to do that remove.

find . -name "*" -exec rm -f {} \;

bobcares
04-18-2002, 01:43 AM
Hi!
This is a wonderful reply... :)
Have a great day

Regards
amar


Originally posted by SPaReK
Try:

rm -f `ls | head`

a few times. That should delete the first 10 files in the directory each time you issue the command. You can change the number of files it deletes each time by using the -n parameter for head:

rm -f `ls | head -n 100`

would delete the first 100 files in the directory. Then after you have done that a few times, try:

rm -f *

and see if it will work then.