Deleting millions of files in Linux

Trying to delete a very large number of files ~1M at one time, you will probably run into this error:
/bin/rm: Argument list too long

Well, you can use find command to delete files:

find . -type f -print -delete

Or even rsync command:

rsync -a --delete empty/ target_directory/

Leave a Reply

Your email address will not be published. Required fields are marked *