Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Clean .DS_Store, .Trash, and ._resources files prior to copy' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Clean .DS_Store, .Trash, and ._resources files prior to copy
Authored by: joeyblades on Mar 09, '10 10:33:55PM

As promised, here's the script I run... but first, a word about my fail-safe mechanism. I didn't want to accidentally nuke dot files in the wrong directory or volume, so I only run this script after cd'ing to the directory where I want to recursively remove dot files. For this script to run, I require a special file named "!UnDotAble" to be in the directory. This file doesn't have any content, so you can just create it with 'touch'. I generally lock it so I don't accidentally delete it when I'm moving stuff back and forth.

OK, here's my script:


if [ -e "!UnDotAble" ]
    dot_clean -m --keep=mostrecent .
    find . -name "\.*" -exec rm -rf {} \;
    echo "!UnDotAble file not found - dot files untouched"

[ Reply to This | # ]