Created
March 14, 2012 11:03
-
-
Save rutger1140/2035793 to your computer and use it in GitHub Desktop.
Clean up DS store files on OSX
This file contains 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
#!/bin/sh | |
# bash script to clean (delete) Finder .DS_Store, .Trashes and ._resources | |
# Use cleandsstores.sh | |
# juanfc 2010-03-06 | |
if [ $# != 1 ] | |
then | |
echo "ERROR: use\n\t`basename $0` dirtoclean" | |
exit 1 | |
fi | |
res=`find "$@" \( -name ".DS_Store" -or -name ".Trashes" -or -name "._*" \) -print` | |
if [[ -z $res ]]; then | |
echo "nothing to delete" | |
exit 0 | |
else | |
echo "Going to delete:" | |
echo $res | |
fi | |
read -p "Ok (yYsS1)?" ok | |
case $ok in | |
[yYsS1] ) | |
find "$@" \( -name ".DS_Store" -or -name ".Trashes" -or -name "._*" \) -exec rm -rf "{}" \; -prune ;; | |
* ) | |
echo "aborted." | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment