In some cases that you have hundreds of thousands or even millions of files in a directory that you want to delete, you will encounter this error:/bin/rm: Argument list too long.
The problem is when you type a command like rm -rf *.*
is replaced with the list of all files, and usually, the memory buffer allocated to shell is small to accommodate let’s say millions of file names.
To solve this issue, I usually use this simple command:
find . -type f -delete