Created
February 27, 2012 13:58
-
-
Save magnusdahlstrand/1923948 to your computer and use it in GitHub Desktop.
Remove all ._* and .AppleDouble-files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
Nice one! Thanks :)
Just use double quotes. Then you don't need xargs:
find . -name '._*' -exec rm "{}" \;
find . -name '.DS_Store' -exec rm "{}" \;
you can also delete files directly with find using the -delete flag:
find . -name '._*' -delete
find . -name '.DS_Store' -delete
find . -name 'Thumbs.db' -delete
this has the benefit of handling the entire operation using just find (without spawning any child processes), and should be the most performant method in this thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
deal with spaces in path