Skip to content

Instantly share code, notes, and snippets.

@magnusdahlstrand
Created February 27, 2012 13:58
Show Gist options
  • Save magnusdahlstrand/1923948 to your computer and use it in GitHub Desktop.
Save magnusdahlstrand/1923948 to your computer and use it in GitHub Desktop.
Remove all ._* and .AppleDouble-files
Remove ._*- and .AppleDouble-files from folders.
Adapted from Torkel's comment on http://hints.macworld.com/article.php?story=20021118060850652
Cred to hiber for suggesting adding -print0/-0 to solve whitespace issue.
See all ._*-files:
find . -name '._*' | more
Remove all ._*-files:
find . -name '._*' -print0 | xargs -0 rm
See all .AppleDouble-files:
find . -name '.AppleDouble' | more
Remove all .AppleDouble-files:
find . -name '.AppleDouble' -print0 | xargs -0 rm -rf
Remove all Thumbs.db-files:
find . -name 'Thumbs.db' -print0 | xargs -0 rm
@magnusdahlstrand
Copy link
Author

Nice one! Thanks :)

@NicolasGoeddel
Copy link

Just use double quotes. Then you don't need xargs:

find . -name '._*' -exec rm "{}" \;
find . -name '.DS_Store' -exec rm "{}" \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment