Any way to remove all folders that contain only .DS_Store recursively? If I try 

sudo find . -name '.DS_Store' -delete


then, within a few seconds, the .DS_Store files get re-created by Finder before 

sudo find . -type d -empty -delete


can take effect.

I can do 

sudo find . -name '.DS_Store' -delete; sudo find . -type d -empty -delete


but this only works on small trees. If there are many subfolders, Finder starts recreating before the 2nd command runs.
Do you have Finder open to that folder? I don't see why the .DS_Store folders would be recreated unless you were viewing them.

If the folders are truly empty, you should be able to use rm -rf &lt;path&gt;. Be careful, it will completely remove that folder and any files in it. Do man rm to learn more.

You shouldn't need the sudo unless you are touching system files. Don't do this unless you understand the ramifications.