Last active
August 29, 2015 13:57
-
-
Save priyadarshan/9431586 to your computer and use it in GitHub Desktop.
Ingest media from DVD-ROM into increasing numbered folder
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 | |
# name of target disk | |
HD="mini2" | |
# path to target directory, do NOT start nor end with / | |
TARGETDIR="disks" | |
# which device is the DVD-ROM drive | |
ROMDRIVE="/dev/disk6" | |
DISK=0 | |
TARGET=/Volumes/$HD/$TARGETDIR | |
while : | |
do | |
DISK=`expr $DISK + 1` | |
echo $DISK "- [CTRL+C to stop]" | |
while [ "$(df -k | grep $ROMDRIVE)" == "" ]; | |
do | |
sleep 1 | |
echo -n "." | |
done | |
echo " " | |
mkdir $TARGET/$DISK | |
# we have to do this here, because it won't show up without media in drive | |
ROMVOLUME=`df -k | grep $ROMDRIVE | cut -d\/ -f5` | |
/opt/local/bin/rsync -r -vv --progress --stats --protect-args "/Volumes/$ROMVOLUME" $TARGET/$DISK | |
/opt/local/bin/rsync -r --quiet --protect-args --checksum "/Volumes/$ROMVOLUME" $TARGET/$DISK | |
drutil tray eject | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment