.DS_Store files are really annoying on Mac.

If you’ve uploaded a heap of them onto a webserver like me, then worry not!
There’s an easy way to remove them all from your VPS server. This should work on most linux machines, Mac OS.

Recursively Remove .DS_Store

Step one, let’s SSH into your Linux or open up terminal on your Mac.
We will first go to the directory where we know all the .DS_Store files got uploaded.

[cc lang=”bash”]cd to/the/location[/cc]

Once we are at the choosen directory type:

[cc lang=”bash”]find . -name ‘.DS_Store’ -type f -delete[/cc]

Press enter and the command will run through all subdirectories to delete all files called .DS_Store!

Remember it’s only all folder beneith the location directory that you CD’ed to.

Let’s it! your server is now clean of unwated .DS_Store files!

You can use the command for other types of files, as well! Just replace ‘.DS_Store’ with whatever file name, or type, that you need to delete. Remember it will recursively go through and delete all matches.