rm * - Argument list too long

Going through and cleaning out a temporary folder I came across a problem using rm *. It came back with the error Argument list too long. Turns out it’s some type of limit in how many files can be passed and the 110,000 that were in the folder was too many.

So I wrote a short little command that seemed to do the trick. First change to the folder where you’ll be deleting files and run the following command.

for i in *; do rm $i; done

You may have to change it to do rm $i -f if it prompts you to delete every file.

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

Leave a Reply