12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/bin/zsh
- #
- # Takes the volume name as argument.
- #
- DRIVE="$1"
- usage()
- {
- printf "usage: quietusb [VOLUME_NAME]"
- }
- #
- # Ensure drive exists.
- #
- if [ ! -d /Volumes/"$DRIVE" ] || [ -z "$1" ]; then
- usage
- exit
- else
- :
- fi
- ######
- # MAIN
- ######
- #
- # Disable Spotlight indexing.
- #
- mdutil -i off /Volumes/"$DRIVE"
- #
- # Remove init / metadata files / directories.
- #
- rm -rf /Volumes/"$DRIVE"/.fseventsd \
- /Volumes/"$DRIVE"/.metadata_never_index \
- /Volumes/"$DRIVE"/.Spotlight-V100 \
- /Volumes/"$DRIVE"/.Trashes
- #
- # Overwrite metadata files with dummy files.
- #
- touch /Volumes/"$DRIVE"/.fseventsd \
- /Volumes/"$DRIVE"/.metadata_never_index \
- /Volumes/"$DRIVE"/.Trashes
|