Skip to content

Instantly share code, notes, and snippets.

@dade80vr
Last active May 11, 2021 20:52
Show Gist options
  • Save dade80vr/334cb4d25dee16c7bb217cec83818272 to your computer and use it in GitHub Desktop.
Save dade80vr/334cb4d25dee16c7bb217cec83818272 to your computer and use it in GitHub Desktop.
Mac OSX Bash script for quick dot files cleaning on USB/SD and auto eject
#!/bin/bash
# DOT files clean script and auto eject
printf "Insert your USB/SD volume name (es: SD): "
read -r volumename
if df | grep -iw "$volumename" > /dev/null
then
echo "Cleaning dot_files into \"/Volumes/$volumename\" .."
sudo dot_clean /Volumes/$volumename
echo "Ejecting volume .."
sudo diskutil eject /Volumes/$volumename
echo "Well done!"
exit 0
else
echo "No \"/Volumes/$volumename\" found - Exiting.."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment