Friday, September 23, 2011

Removing .DS_Store files on Macintosh OS X?


Issue

Many users have experienced and been puzzled by the .DS_Store files, which exist on Macintosh OS X machines and some web servers. This TechNote will explain an issue related to .DS_Store files and discuss ways to remove these files.
Note: Issues dicussed here are in relation to third-party software and Macromedia does not provide support for third-party software.

Reason

The .DS_Store files are created by the Macintosh OS X Finder. The these files keep track of folder view options, icon positions, and other visual information about folders.

When a new directory is accessed using the OS X Finder, a .DS_Store file will be created in that directory. Once the directory is viewed using the Finder a .DS_Store file will be permanently created in that directory. Currently, the option to create a .DS_Store file can not be disabled.
Users should be concerned about .DS_Store files being uploaded to the web servers. Since .DS_Store files contain some vital folder information they can be exploited to obtain information about system configurations. Please see the following third-party link for more information: Apple security updates.

Solution

There are a few solutions to resolve this problem. Below is a list of options:
  • To avoid creating .DS_Store files, do not to use the OS X Finder to view folders. An alternative way to view folders is to use UNIX command line.
  • To remove the .DS_Store files a third-party product called DS_Store Terminator can be used.
  • To delete the .DS_Store files from the entire system a UNIX shell command can be used.
    1. Launch Terminal from Applications:Utilities
    2. At the UNIX shell prompt enter the following UNIX command:

      sudo find / -name ".DS_Store" -depth -exec rm {} \;
    3. When prompted for a password enter the Mac OS X Administrator password.

      This command is to find and remove all occurrences of .DS_Store starting from the root (/) of the file system through the entire machine.
  • To configure this command to run as a scheduled task follow the steps below:
    1. Launch Terminal from Applications:Utilities
    2. At the UNIX shell prompt enter the following UNIX command:

      sudo crontab -e
    3. When prompted for a password enter the Mac OS X Administrator password.
Once in the vi editor press the letter I on your keyboard once and enter the following:

15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;

This is called crontab entry, which has the following format:

Minute Hour DayOfMonth Month DayOfWeek User Command.

The crontab entry means that the command will be executed by the system automatically at 1:15 AM everyday by the account called root.

The command starts from find all the way to \. If the system is not running this command will not get executed.

To save the entry press the Esc key once, then simultaneously press Shift + z+ z.

Note: Information in Step 4 is for the vi editor only.

Source: http://kb2.adobe.com/cps/168/tn_16831.html

No comments:

Post a Comment