Skip to content

Instantly share code, notes, and snippets.

@priyadarshan
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save priyadarshan/9431586 to your computer and use it in GitHub Desktop.
Save priyadarshan/9431586 to your computer and use it in GitHub Desktop.
Ingest media from DVD-ROM into increasing numbered folder
#!/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