Home / Web Hosting / How to delete multiple files in various directories in Linux

How to delete multiple files in various directories in Linux

Mac OS X crashing after deleting Windows Thumbs.db files

Question: When uploading files to my Linux server from my windows computer, I have accumulated WS_FTP.log files and thumbs.db files in multiple directories. Is there an easy way to delete all of them at once without navigating through each directory?

Answer: With Linux, of course there is. You can accomplish this with the “find” command, and you can apply the same technique to any files you need to remove on a mass scale. To remove thumbs.db files, enter the following from a SSH command line:

find /home/user -name Thumbs.db -ok rm {} \;

And if you do not want to be prompted for each deletion, add the “-f” flag:

find /home/user -name Thumbs.db -ok rm -f {} \;

To find any other file, just replace the “Thumbs.db” with the appropriate filename.

find /home/user -name WS_FTP.LOG -ok rm -f {} \;

Source: webhostingtalk.com
Flickr: Flickr

Check Also

servers

Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …