UNIX


DOSFLP


1 : 2 # @(#) dosflp v1.0 Wildcard copies from DOS floppy Author: Russ Sage 4 EXP=.\* 5 DRIVE="A:" 6 OP="c"   8 if [ "$#" -gt 0 ] 9 then for ARG in $@ 10 do 11 case "$ARG" in 12 -a) EXP='.*\.asm$';; 13 -c) EXP='.*\.c$';; 14 -d*) DRIVE="`echo $ARG | cut -c3-`:";; 15 -e*) EXP='`echo $ARG | cut -c3-`';; 16 -h) EXP='.*\.h$';; 17 -l) OP="l";; 18 -r) OP="r";; 19 -s*) DRIVE="$DRIVE`echo \"$ARG" | cut -c3- `/";" 20 *) echo "dosflp: arg error" 21 echo "usage: dosflp [-a] [-c] [-d] [-e] [-h] [-l] [-r] [-s]" 22 exit 1;; 23 esac 24 done 25 fi   27 case $OP in 28 c) echo "\nCopying files from $DRIVE to `pwd`";; 29 l) echo "\nListing files on $DRIVE" 30 dosdir $DRIVE | more 31 exit;; 32 r) echo "This option removes all the data on the floppy." 33 echo -n "Do you want to do this (y/n): " 34 read RSP 35 if [ "$RSP" = "y" ] 36 then echo "\nRemoving files on $DRIVE" 37 else exit 38 fi;; 39 esac   41 dosls $DRIVE | tr "[A-Z]" "[a-z]" > /tmp/doslist   43 for FILE in `grep "$EXP" /tmp/doslist` 44 do 45 echo $FILE 46 case $OP in 47 c) doscp $DRIVE$FILE .;; 48 r) dosrm $DRIVE$FILE;; 49 esac 50 done   52 rm /tmp/doslist