.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.

cd to/the/location

Once we are at the choosen directory type:

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

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.