Created
July 15, 2025 17:37
-
-
Save adrienjoly/ec10c511538e8492553d1bc17b8311a1 to your computer and use it in GitHub Desktop.
a bash/terminal script to copy all files of a volume (with their attributes) to a local directory. tested on macOS.
This file contains hidden or 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
# Usage:\ | |
# $ cd /Volumes | |
# $ ls | |
# $ ./backup-disk.sh "Archives musique" | |
set -e # stop the script if any command fails with a non-zero exit code | |
echo Backup "$1" to "~/Downloads/BluRay/$1/" ... | |
cp -Rpnf "./$1" "$HOME/Downloads/BluRay/" | |
chmod -R +w "$HOME/Downloads/BluRay/$1" | |
cd "$HOME/Downloads/BluRay/$1/" | |
ls -R > "$1.txt" | |
cp "$1.txt" .. | |
cd /Volumes | |
say "backup is finished" | |
drutil eject external |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment