If you are trying to delete a very large number of files you may get this error.
/bin/rm: argument list too long
when you type “rm -rf *”, the “*” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a small buffer of memory allocated to storing this list of arguments and if it gets filled then shell will not execute the program.
more efficient way of removing tons of files in a directory is by using find command with delete option some thing like this.
cd /directory to delete find . -type f -delete
we can also show the filenames while deleting them
find . -type f -print -delete
./dblog.txt1405418 ./dblog.txt799222 ./dblog.txt248899 ./dblog.txt1264370 ./dblog.txt1787419 ./dblog.txt2565511 ./dblog.txt2043335 ./dblog.txt266967 ./dblog.txt2030396 ./dblog.txt1597576 ./dblog.txt996214 ./dblog.txt565343