I have been looking into copying the contents of old CDs onto mobile disks in order to save space and preserve the content, since rewritable CDs appear to degrade over time (at least the ones I am using). I have come up with this little script which works nicely with ISO9660 formated CDs
#!/bin/bash
echo "Reading Volume Information"
SOURCECD=/dev/cdrw
OUTPUTCDDIR=/workarea/tmp
isoinfo dev=$SOURCECD || { printf "%b" "FAILED.\n" ; exit 1 ; }
VOLUMEID=`isoinfo -d dev=$SOURCECD | grep "Volume id" --color=never | awk -F": " '{ print $2}'` || { printf "%b" "FAILED.\n" ; exit 1 ; }
VOLUMESIZE=`isoinfo -d dev=$SOURCECD | grep "Volume size is" --color=never | awk -F": " '{ print $2}'` || { printf "%b" "FAILED.\n" ; exit 1 ; }
LABEL=$VOLUMEID-$VOLUMESIZE
OUTPUTDIR=$OUTPUTCDDIR/$LABEL
if [ -d "$OUTPUTDIR" ]; then # Dir exists, mention that...
echo "$OUTPUTDIR exists...exiting"
exit 1;
fi
mkdir -p "$OUTPUTDIR" || { printf "%b" "FAILED.\n" ; exit 1 ; }
OUTPUTISO=$OUTPUTDIR/image.iso
echo "Copying ISO for $LABEL"
dd if=$SOURCECD of="$OUTPUTISO" bs=2048 conv=sync || { printf "%b" "FAILED.\n" ; exit 1 ; }
echo "Verify Structures for $LABEL"
isovfy -i "$OUTPUTISO" > "$OUTPUTDIR"/verify-report.txt || { printf "%b" "FAILED.\n" ; exit 1 ; }
file "$OUTPUTISO" > "$OUTPUTDIR"/file-report.txt || { printf "%b" "FAILED.\n" ; exit 1 ; }
echo "Generating Metadata for $LABEL"
md5sum -b "$OUTPUTISO" > "$OUTPUTDIR"/md5.sum || { printf "%b" "FAILED.\n" ; exit 1 ; }
isoinfo -d -i "$OUTPUTISO" > "$OUTPUTDIR"/metadata.txt || { printf "%b" "FAILED.\n" ; exit 1 ; }
isoinfo -l -i "$OUTPUTISO" > "$OUTPUTDIR"/ls-lrt.txt || { printf "%b" "FAILED.\n" ; exit 1 ; }
eject $SOURCECD || { printf "%b" "FAILED.\n" ; exit 1 ; }
This works nicely with ISO9660 formatted CDs, however fails (not surprisingly) with UDF formatted CDs and DVDs. Does anyone have any ideas of tools like this which I can build to use a similar script for DVDs?