Sunday, June 4, 2017

Delete large number of files - LINUX

Delete large number of files - LINUX


Go to the folder location

cd < folder name>

A faster way of deleting files is the -delete flag:

find . -type f -delete

To show the filenames while deleting them:

find . -type f -print -delete

To show how many files will be deleted, then time how long it takes to delete them:

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

The above commands will remove all the files in the folder, then you can use rm -rf to remove the folder.

No comments:

Post a Comment