[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: -bash: /bin/rm: Argument list too long

A possible solution independent by the kind of fs layer and valid for all Unixes....
If in any way you can get the find command to "find" the file names you need, you can issue a command like the following:

find path expression -exec rm {} \;

where path and expression are the ones detailed in man page for find command

for example, if you want to remove only all the regular files belonging to user foouser under the filesystem named /foofs and don't want to cross other filesystem and don't want to go down deeper than 3 levels you can do

cd /
find /foofs -user foouser -maxdepth 3 -xdev -type f -exec rm {} \;

In this way you execute the rm commands one by one and don't encounter the arg list too long message.
If instead you use a command like

find path expression | xargs rm

you encounter the same limit problem.




-----Original Message-----
From:	N Nair [mailto:nandagopalnair netscape net]
Sent:	Mon 2/24/2003 9:29 PM
To:	ext3-users redhat com
Subject:	-bash: /bin/rm: Argument list too long


    Is there a  limit to the number of arguments that can be passed to 
fileutils programs such as mv or rm ? If yes, is it filesystem 
dependant/kernel config dependant/fileutils version dependant?  Can this 
maximum limit be tuned/controlled ?  I googled on it a bit, but couldn't 
find anything much more relevant than a message in the OS-X forum.


    Someone asked me this question in a linux-related forum and I 
decided to experiment on my box ( RedHat 8.0 running vanilla kernel 
2.4.20; fileutils version 4.1.9 ) to find out what the current limit 
was. I  found that 12806 filenames can be passed to rm at a time without 
generating the error shown in the subject line. (Took me about a dozen 
tries to reach this figure.)

  Your comments would be extremely valuable.


Ext3-users mailing list
Ext3-users redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]