Copy your CDs/DVDs collection easily on your MacsteemCreated with Sketch.

in music •  8 years ago 

After collecting for years music and ripping it to mp3, back then when HDD or SSD were expensive I used to save those to CDs and later on on DVDs. I used some nice software to catalogue the mediums so I know where what track or album is.
Some days ago I decided to copy all of the music to a HDD (actually two, that are being mirrored) as not only of convience, but unfortunately some of the CDs started falling apart.
So here is a simple shell-bash script (just save it as i.e. copy.sh) that will help you do so.
You got to the terminal, do a 'diskutil list' to recognize what disk the CD/DVD drive ist and then u start the script with 'caffeinate -i sh copy.sh disk3' (supposed you saved it as copy.sh and the drive is disk3). The good thing is you can work normally on your Mac while it automatically does everything - after ejecting the Medium, you put a new one in and close it! Simple as that, when finished you close the Terminal ,) Enjoy

P.S.: Volumes/MusicArchiv/Alben/$opticalMedia --> This is the location where it is saved, in that case my external Volume called MusicArchiv ind the folder Alben where it creates a folder named like the Name of the Medium.

#/bin/bash
while [ 0 ]
do
opticalMedia=`df | grep $1 | cut -d '/' -f 5`
if [ -d "/Volumes/$opticalMedia" ]; then
    if [ ! "$opticalMedia" ]; then
        printf "."
        sleep 3s
        continue
    fi
    printf "\n"
    echo $opticalMedia
    if [ -d "/Volumes/MusicArchiv/Alben/$opticalMedia" ]; then
        timestamp=`date +"%%Y%m%d_%H%M"`
        targetname="$opticalMedia-$timestamp"
    else
        targetname="$opticalMedia"
    fi
    rsync -aEp --progress "/Volumes/$opticalMedia/" "/Volumes/MusicArchiv/Alben/$targetname"
    diskutil eject /dev/$1
else
    echo "error"
fi
done
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!