How to solve /bin/rm: Argument list too long !

When you’re trying to delete the contents of a large directoty, for example php sessions, you might come across this error when running:

rm -rf /path/to/folder

To solve this issue I use the following:

# find /path/to/folder -name '*' | xargs rm

Make sure the folder path you provide is correct, this action is destructive and non reversible.

About Pavel Petrov 2 Articles |  21 How-tos
Pavel is a senior developer for the last 7 years, with extended interest in Linux administration, WordPress and Symfony.

Be the first to comment

Leave a Reply

Your email address will not be published.