Fast way to recursively delete large amount of files.: Difference between revisions

From munkjensen.net/wiki
(Created page with "Create an empty directory i the same folder as the one that contains the large amount of files you want to delete. <pre>mkdir empty_dir</pre> Then execute this command: <pre>r...")
 
mNo edit summary
 
Line 6: Line 6:
This is remarkably faster that using the otherwise well known command
This is remarkably faster that using the otherwise well known command
<pre>rm -rf yourlargedirectory/</pre>
<pre>rm -rf yourlargedirectory/</pre>
[[Category:Unix terminal]]

Latest revision as of 19:17, 25 April 2018

Create an empty directory i the same folder as the one that contains the large amount of files you want to delete.

mkdir empty_dir

Then execute this command:

rsync -a --delete empty_dir/    yourlargedirectory/

This command will grab everything in the directory "yourlargedirectory" and 'archive' it in "empty_dir" if a version of that already is there, else it will be deleted. This is remarkably faster that using the otherwise well known command

rm -rf yourlargedirectory/