How to deleting large number of files in Linux

When try to delete directory that contain a ton of files with rm -rf target_dir/ that very slow or even crashes, so we have other way to delete that directory with perl or rsync 

rsync way

mkdir empty_dir
rsync -aP --delete emptr_dir/ target_dir

perl way

cd target_dir
perl -e 'for(<*>){((stat)[9]<(unlink))}'



Leave a Reply

%d bloggers like this: