How to Recursively Remove .DS_Store Files on Mac OS

If you are a theme developer and wanna submit your theme to WordPress.org theme repository then of course you must have remove all  .DS_Store file from your theme directory. In order for your theme to pass the Theme-Check plugin review, you need to remove .DS_Store files from the theme folder. Doing that by hand is really boring, painful, and repetitive. We will do it using command line recursively. 

Remove .DS_Store

  1. Open up Terminal
  2. In the command line, cd to/your/directory
  3. Finally, in the command line, type: find . -name '.DS_Store' -type f -delete Press enter.

Warning: Never use a wildcard (*) with this command, unless you know what you’re doing. Bad things can happen if you don’t.

This snippet will remove .DS_Store files from the selected folder, as well as all of the folders that it contains. All of them. At once. This command can be used for other types of files, as well. Just replace '.DS_Store'with whatever file name, or type, that you want to delete.