Click to See Complete Forum and Search --> : argument list too long for ls


kowalsky
10-15-2001, 07:44 PM
hi all,
is there any way to set a higher limit for the number of arguments that a command like ls or rm may take; i couldn't say exactly what this limit is right now but i suppose is somewhere around 1000... so, when i'm trying to delete 5000 files in a directory, there's no way unless i delete the whole directory rm -fr and then mkdir it back.
thanks,
kowalsky

thedexman
10-15-2001, 08:23 PM
um, please tell me you're not writing out the names individually

scanez
10-15-2001, 09:25 PM
Um, so are you trying to delete all files in a given directory, or just thousands of files but not all?

SC

Hawg
10-15-2001, 11:07 PM
I run into this problem alot. ls and rm and what not expand the args in the shell first, and then pass them to ls as a group which hits the upper limit. What you want is an app that takes the arg list one at a time. In this case you'll want to use something to the effect of

find . -name "files" -print | xargs "some command"

don't quote me on the syntax but this is the general form

[ 15 October 2001: Message edited by: Hawg ]