Great source for deleting millions of files in a ubuntu directory when you get an error:

/bin/rm: Argument list too long.

Well, simply navigate to the directory with the problem and execute this:

ls -1 | wc -l && time find . -type f -delete

Apparently, ‘find’ can handle large number of files better than ‘rm’ and it even has a -delete feature!

I just deleted 3 million files using this method.

Special thanks to Deleting tons of files in Linux Argument list too long | SteveKamerman.com.