DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Recursively Remove .DS_Store Files In OS X

  • submit to reddit
        This shell alias will recursively remove all .DS_Store files from the current directory up.

alias rmdsstores='find ./ -type f | grep .DS_Store | xargs rm'


Snippets Manager replied on Thu, 2009/01/29 - 11:14pm further optimization (if it doesn't show up, there should be single quote around the *.pyc): find . -name '*.DS_Store' -type f -delete

Snippets Manager replied on Wed, 2007/05/16 - 6:54pm

Optimized? Whoa... that is much nicer... of course, whatever gets the job done. Unless your running on a 8088, which would lend it self to much optimizing of your shell aliases.

Batzooh Revil replied on Tue, 2008/01/15 - 10:59am

Not very optimized !!. Two pipes and 3 commands calls. Here is a best way with only find command : find . -name *.DS_Store -type f -exec rm {} \;