Write a shell script to implement the DISKCOPY command of DOS command, which allows a user to copy the complete contents of a diskette to another diskette. Under UNIX / Linux we can use dd command to copy disk.
dd is use to copy a file, converting and formatting according to the options. Since everything is considered as a file under Linux / UNIX you can write files to a diskette with dd command itself. Linux disk copy done using /dev/fd0 (first floppy drive). You can easily make Linux disk backup with dd command.
#!/bin/bash # Shell Script to copy the complete contents of a diskette to another diskette # under UNIX / Linux. # ------------------------------------------------------------------------- # Copyright (c) 2007 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- SOURCE="$1" DEST="$2" if [ $# -le 1 ]; then echo "Copies the contents of one floppy disk to another." echo "diskcopy /dev/fd0 /dev/fd1" echo "diskcopy /dev/fd0 /tmp/floppydisk.img" exit 1 fi if [ ! -b $SOURCE ]; then echo "Error - Floppy device $SOURCE does not exits." exit 2 fi if [ ! -b $DEST ]; then echo "Error - Floppy device $DEST does not exits." exit 2 fi echo "Enter disk in $SOURCE and press [Enter] key..." read enterKey dd if=$SOURCE of=$DEST
- Download Script
- Email this to a friend
- Printable version
- Rss Feed
{ 0 comments… add one now }