Solution to rm’s “Argument list too long”

I was trying to delete of a lot of files on my Linux server the other day. While trying to “rm *” I received this error message: /bin/rm: Argument list too long.

After a little research, I discovered that rm limits the number of files you can delete at any one time. You can overcome that problem by entering this command:

find . -name “*” -print | xargs rm

Note that this command deletes all files in the current directory. You will need to modify the command if you to limit your delete selection.