Created
April 4, 2016 22:45
-
-
Save cognivator/4bcb3dc870ce000af478c4ae8b337260 to your computer and use it in GitHub Desktop.
Prevent OSX clutter on external storage
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/bash | |
# protect an ext drive (USB, memcard, etc) from the following files: | |
# .Spotlight-V* (Spotlight index) | |
# .Trashes (Deleted files) | |
# .fseventsd/* (journaling) | |
# .DS_Store (finder prefs... not implemented, yet) | |
# run this from the root of the drive that should be protected | |
echo "Before protection:" | |
ls -al | |
rm -rf .{,_.}{fseventsd,Spotlight-V*,Trashes} | |
mkdir .fseventsd | |
touch .fseventsd/no_log .metadata_never_index .Trashes | |
chmod 444 .fseventsd/no_log .fseventsd .metadata_never_index .Trashes | |
echo "After protection:" | |
ls -al |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment