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

01.13.2008
| 18366 views |
  • 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'
    

Comments

Snippets Manager replied on Fri, 2009/01/30 - 12:14am

Hmm...one 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 - 7: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 - 11: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 {} \;