The “.DS_Store” file is hidden by default, and most of the time it doesn’t cause any trouble – that is until you need to zip the folder and send it to your friends (using another operating system) or upload your development folder to the server. You will find that the folder contains many unsightly “DS_Store” files that you don’t want to share with you friends. If you are looking for a way to quickly remove all instances of “.DS_Store” file in a folder, here is a command that you can use: Note: the following command will work in Linux as well.

  1. Open a terminal in your Mac OS X.
  2. Enter the following command: Replace the “/path/to/folder” with the actual filepath of the folder, for example “/var/www/html.” What the above command does is use the find command to search a particular folder (recursively) for files with a name that includes “.DS_Store” and delete them when found. That’s it. You can now easily remove all instances of “.DS_Store” files before you share the folder with others.