How to Recursively Remove .DS_Store Files on Mac OS X

The following command will remove all .DS_Store files in a directory where it is executed as well as that particular directory’s subdirectories:

find . -name ‘*.DS_Store’ -type f -delete

Why would you want to remove .DS_Store files? The .DS_Store files store Finder-specific preferences concerning the display of each of your folders. Removing these files is an easy way to reset your display preferences. Also, if you’re moving files between your Mac and another operating system such as Windows or Linux these files can cause unexpected problems and should be removed prior to transfer.

This command works on Mac OS X and Unix-type operating systems such as Linux. What follows is a step-by-step guide on how to properly use this command on Mac OS X.

Directions on how to recursively remove .DS_Store files on Mac OS X:
1. Open up the Terminal application (/Applications/Utilities/

2. Find the directory/folder that you wish to recursively delete the .DS_Store files from. For this tutorial let’s pretend you want to delete all the .DS_Store files in your Pictures folder and every folder inside that folder. Type this command into Terminal (without pressing the return key):


3. Then drag and drop your Pictures folder onto the Terminal window. The cd command should now look something like this — where ariadoss is your Mac’s “short name” (i.e. your username):

cd /Users/ariadoss/Pictures

4. Press the return/enter key on your keyboard.

5. Type the following command into Terminal and press return to execute it:

find . -name ‘*.DS_Store’ -type f -delete

Congratulations the .DS_Store files have been deleted. Please note that this command will just delete existing .DS_Store files; your Mac will continue to create them.

If you wish to disable the creation of .DS_Store files on external volumes type the following command into Terminal and hit enter (you may need to log out or restart your computer after executing this command):

defaults write DSDontWriteNetworkStores true

Originally published at on July 15, 2009.



Entrepreneur, Technologist & Product Guy

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store