User Tools

Site Tools


blog:delete_large_number_of_files

Delete large number of files

I had to delete thousands of files. The command “rm” simply took forever. Then I learned you can use rsync to do the job.

First, create an empty directory such as

mkdir empty

Then, rsync it with the folder you want to delete using

rsync -av --delete empty/    todelete/

This is super fast comparing to rm.

Using perl

perl -e 'for(<*>){((stat)[9]<(unlink))}'
You could leave a comment if you were logged in.
blog/delete_large_number_of_files.txt · Last modified: 2016/02/14 21:33 by johnny