Searching...

How to delete a large number of files in a directory - Linux

It may be necessary to clean up a directory from unnecessary data. This often involves "cache" directories. In a Linux shell, you can use various combinations of commands, but a very effective method for cleaning up thousands of files is to use the rsync trick:

rsync -a --delete new_directory/ cache/

From the example, you create a "new_directory," which is, of course, empty, and the directory containing the files to be deleted is "cache."

Comments

To submit comment you have to be logged-in