Delete .DS_Store folders

To delete the .DS_Store folder recursively in a directory, execute the following command in a Terminal:

find . -name '.DS_Store' -type f -delete

Note: Before executing the command, locate yourself in the parent directory using cd <PATH>.

You can remove the .DS_Store folder from the entire system by executing the following command:

sudo find / -name «.DS_Store» -depth -exec rm {} ;

Note: It will take a while to run.

You can enable/disable the creation of the .DS_Store folder with the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true|false