#!/bin/sh #diskcopy command #Josh Gentry clear #clear the terminal #warn user echo "This command will delete all files on the target disk before copying!!!" #prompt user to insert source disk echo -n "Insert source disk and hit ..." read Response test=`cat /etc/mtab | grep floppy | wc -l` if [ $test -eq 0 ] then mount /dev/fd0 /mnt/floppy #mount target disk fi cd /tmp rm -fr diskcopy.swp #remove old swap space for this operation mkdir diskcopy.swp #create swap space for this operation cp /mnt/floppy/* /tmp/diskcopy.swp #copy contents of source to swap umount /mnt/floppy #prepare for switching of disks echo "WARNING!!!! All files currently on target disk will be deleted!" echo -n "Insert target disk and hit ..." #prompt user to switch disks read Response mount /dev/fd0 /mnt/floppy #mount target disk rm -rf /mnt/floppy/* #remove any files on target cp /tmp/diskcopy.swp/* /mnt/floppy #copy files from swap to target rm -rf /tmp/diskcopy.swp #remove swap space for this command echo "Disk copied." exit