Have .DS_Store files ever appeared in your folders and you don't know where they came from? Do you know what they are and what they are for ? Would you like to remove them permanently? In this article we explain what those .DS_Store files are, what their function is and how you can get rid of them .
The first thing to explain is their function and why they appear. The .DS_Store files are created by the Mac OS X operating system in any directory (including network folders) that is opened with Mac Finder, and its function is to “memorize” the position of the icons and the background of the folders. Under OS X these files are hidden and as a general rule they are not seen, but from Windows or Linux we will see them in all the directories that we have previously viewed with Finder.
So, the function of .DS_Store is more or less like the Windows desktop.ini, or like the thumbs.db only that the latter only appears in directories that contain images, since it is a database of thumbnails.
How to remove all .DS_Store files?
The .DS_Store files can be removed quickly and it is also safe to do so, although you should bear in mind that doing so will lose OS X's ability to memorize the position of the icons and their backgrounds.
To perform a mass removal in OS X, you must open a "Terminal" (from spotlight you write Terminal and run it, or else from the Launchpad -> Applications -> Utilities). Once the terminal is open, you must position yourself in the root directory by executing the command (without quotes) "cd \" and after doing so, execute the following command:
sudo find / -name «.DS_Store» -depth -exec rm {} \;
You will be asked for the computer administrator password, and after providing it, all the .DS_Store files will be removed from the system.
How to prevent .DS_Store files from reappearing
It is also possible to tell Mac OS X not to generate any .DS_Store files again, and also this task is reversible so you can test how you are doing and if you don't like or regret leaving it as it was.
To do this, open a Terminal again and type the following command:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
If we want to leave the system as it was, we will simply have to repeat this process but changing the word "true" at the end of the command to "false" and we will have our system again with the .DS_Store that OS X creates by default.