#!/bin/bash # CD/DVD Mass Importer # # Version 1.0 by Axel Werner [mail@awerner.myhome-server.de] # # helps user/admin to import or "copy" a massive amount of # CDs or DVDs to the local directory through automation. # # It automaticly opens the cdrom or dvd tray # prompts the user to insert a media and press any key # then it creates a sequal numbered subdirectory like cd1 cd2 # etc and copies the content of the cd/dvd there. # when finished it ejects the cd automaticly and prompts for # next cd to insert. # comes handy when handling large data collections on cd/dvd # on restoring backups or similar. # ############################## # # Changes: # ============= # # 2011-01-10 A.Werner RELEASE 1.0 # # ############################## SERIAL=0 while true ; do let SERIAL++ clear echo "opening CDROM tray..." echo eject -T /dev/cdrom1 echo "press CTRL+C to cancel. Else insert next CD/DVD" echo "for copy CD to 'cd$SERIAL/' , then close the CD-TRAY" echo "and press any key to start copy process..." read mount /dev/cdrom1 while [ -d "cd$SERIAL" ] ; do echo "it seems 'cd$SERIAL/' already exists. Trying next Serial..." let SERIAL++ done mkdir "cd$SERIAL" cp -av /media/cdrom0/* "cd$SERIAL/" umount /dev/cdrom1 echo "...done" echo "resetting file permissions for samba..." chown -R yourusername.users "cd$SERIAL/" chmod -R 770 "cd$SERIAL/" echo "...done" done