Created
August 15, 2014 15:48
-
-
Save thewellington/db4b1561bca0d67e65ce to your computer and use it in GitHub Desktop.
This script will recursively delete the .DS_Store file generated by Macintosh computers. It takes a single argument, the path of the directory where you wish to begin the recursive deletion. Works on both Linux and Macs (with GNU find or BSD find)
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
#!/usr/bin/env bash | |
# | |
# This script will recursively delete the .DS_Store file generated by Macintosh computers. | |
# It takes a single argument, the path of the directory where you wish to begin the recursive deletion. | |
# | |
# works on both Linux and Macs (with GNU find or BSD find) | |
# | |
# EXAMPLE: | |
# dsstore_cleanup.sh /path/to/directory/ | |
# | |
# v 0.1 2014-08-15 by bill@wellingtonnet.net | |
if [ "$1" != "" ]; then | |
WORKING_PATH="${1%/}" | |
else | |
WORKING_PATH='.' | |
fi | |
case $( uname -s ) in | |
Linux) find "${WORKING_PATH}" -name .DS_Store -printf \"%p\"\ \ | xargs rm;; | |
Darwin) find "${WORKING_PATH}" "-name" ".DS_Store" -exec rm {} \;;; | |
*) echo "Sorry, this script is not setup for this OS";; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment