Today, I needed to empty a folder through bash on my Linux server that contained a lot of files. The files where maybe 2kb, but all the files together contained over 400Mb.
So I used rm * to remove them, but it threw me a nice error: bash: /bin/rm: Argument list too long . Looks like rm has its limits 🙂
Use ‘find’ to pipe all the matching files to ‘rm’, one at a time:
find . -name '*' | xargs rm
And I’m a happy camper again.