Thursday, July 12, 2012

Terminal fun: Deleting repetitive files in OS X




To manage various settings, both OS X and Windows will often place small files within folders that help the system manage their contents. A common file of this type in OS X is the .DS_Store file, and a common type in Windows is the Thumbs.db file. While these files are usually hidden, in some cases (especially those where multiple operating systems share the same storage spaces), you may see these files show up and contribute to window clutter.


If you want to remove them and tidy up your filesystem, there are several utilities that can do this for you, but another option is to use the OS X Terminal's Find command, which with a simple setup can be used scour the entire system for a specific file name pattern, and then optionally delete the file.


To use this command, open the Terminal utility (in the Applications/Utilities/ folder) and then perform the following steps:



  1. Type "sudo find" followed by a single space.

  2. Drag your starting folder to the Terminal Window (or use a forward slash to indicate the system root for the whole system).

  3. Type "-name" followed by a space and then the file name pattern you would like to search for in quotes.

  4. To have the command delete files, finish off the command with the "-delete" flag.


When you are done, the command should look something like the following:


sudo find / -name ".DS_Store" -delete


... [Read more]

No comments:

Post a Comment