Removing .DS_Store files on Macintosh OS X

There are a number of ways to remove .DS_Store files from OSX. Below is a list of options:

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.

If you wish you can configure this command to run as a scheduled task. To do this 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.

 

4. Once in the vi editor and 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s