[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] (V.4.4.1) Floppy Copier



I needed a quick floppy disk copier - found this code, modified it as
indicated below and saved it as floppycopy.sh - chmod 777 for easy
access and then ran it with ./diskcopy.sh - works like a charm. Hope it
helps someone "out there"
cheers
Alan Hodson
El Paso ISD,TX
http://links.episd.org/
-=o=-
---------------- 8>< ----------------

#!/bin/sh
#diskcopy command
#Josh Gentry - updated (/mnt/->/media/ A. Hodson)

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 <RETURN>..."  
read Response

test=`cat /etc/mtab | grep floppy | wc -l`
if [ $test -eq 0 ]
  then
  mount /dev/fd0 /media/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 /media/floppy/* /tmp/diskcopy.swp   #copy contents of source to swap
umount /media/floppy                   #prepare for switching of disks

echo "WARNING!!!!  All files currently on target disk will be deleted!"
echo -n "Insert target disk and hit <RETURN>..."   #prompt user to
switch disks
read Response

mount /dev/fd0 /media/floppy                #mount target disk
rm -rf /media/floppy/*                      #remove any files on target
cp /tmp/diskcopy.swp/* /media/floppy        #copy files from swap to target
rm -rf /tmp/diskcopy.swp                  #remove swap space for this
command
echo "Disk copied."
exit

---------------- 8>< ----------------


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]