Thursday, December 1, 2016

Fast way to delete milion files in Linux

Solutions for problem when trying to delete million files and rm command says:
argument too long

1. using combination of find and xargs
# find . -print0 | xargs -0 rm -f
2. using rsync with empty directory (so far the fastest way I've found)
# rsync -a --delete /path/to/empty-directory/ /path/to/dir-to-be-deleted/