bash - Argument List Too Long

July 29th, 2007
No Gravatar

I’ve got several scripts that have been failing recently due to the high number of files in a directory.

Say for example, my site wide spamassassin Bayes learning script that runs nightly, it has started failing sometimes when a lot of spam has been caught by users.

I’d see

bash: /bin/rm: Argument list too long

A fix would look like this

for i in /your/directory
do
rm -rvf $i
done

find would probably also do the same job.

Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo


Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Geekery, Linux category.

Leave a Reply