APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

We no longer offer ftp downloads. If there is a file you need referenced here, please contact me by email and I will get it to you.


Tony Lawrence: cpdos

This is an ancient post with no relevance to modern systems.

Download cpdos

(Shift-click on link if you don't get a save-as dialog)



ToDos() {
clear
DownScreen
echo "  Current Directory is `pwd`\n"
test -r .
if [ $? != 0 ]
then
echo "Cannot read from this directory"
echo "Press Enter"
read j
return
fi
echo "Copy files TO Dos Diskette"
echo "Enter Name of file to copy or Wildcard (*, *.doc, etc)"
read akey
all="y"
for i in $akey
do
if [ $all != "Y" ]
then
echo "Copy $i (y)es, (Y)es to all, (n)o (N)o to all?"
read all
fi
case $all in
        [Yy]) echo "Copying $i";doscp $i /dev/rfd0135ds18:$i ;;
        N) return;;
esac
done
echo "Press Enter"
read ak
}
AllFrom() {
clear
DownScreen
all="y"
echo "  Current Directory is `pwd`\n"
test -w .
if [ $? != 0 ]
then
echo "Cannot copy to this directory!"
echo "Press Enter"
read j
return
fi
echo "Copy From Dos"
dfiles=""
for i in `dosls /dev/rfd0135ds18`
do
if [ "$all" != "Y" ]
then
echo "Copy $i (y)es, (Y)es to all, (n)o (N)o to all?"
read all
fi
case $all in
        [Yy]) dfiles="$dfiles $i";
              echo "Copying $i From Dos";
              doscp /dev/rfd0135ds18:/$i $i ;;
        N) return;;
esac
done
echo ""
echo "Change Ownerships or Permissions on files? (Y/N)"
read akey
case  $akey in 
        [Yy]) : ;;
        *) return;;
esac
OK="N"
while [ "$OK" != "Y" ]
do
if [ $LOGNAME = "root" ]
then
echo "Enter owner? (default \"$MLOGNAME\")"
read owner
: ${owner:=$MLOGNAME}
else
owner=$LOGNAME
fi
if [ $LOGNAME = "root" ]
then
echo "Enter group? (default \"group\")"
read group
: ${group:="group"}
else
group="group"
fi
echo "Enter permissions (default 666)"
read perm
: ${perm:="666"}
echo $owner $group $perm
echo "All OK?"
read OK
if test -z $OK
then
OK=Y
fi
case $OK in
        [Yy]) OK=Y ;;
        *) continue ;;
esac
for i in $dfiles
do
chown $owner $i
chgrp $group $i
chmod $perm $i
done
done


}

FromDos() {
clear
DownScreen
echo "  Current Directory is `pwd`\n"
test -w .
if [ $? != 0 ]
then
echo "Cannot copy to this directory!"
echo "Press Enter"
read j
return
fi
echo "Enter Name or blank for prompts"
read akey
if [ "$akey" = "" ]
then
AllFrom
else
echo "Copying $akey from Dos"
doscp /dev/rfd0135ds18:/$akey $akey
dfiles=$akey
echo ""
echo "Change Ownerships or Permissions on $dfiles? (Y/N)"
read akey
case  $akey in 
        [Yy]) : ;;
        *) return;;
esac
OK="N"
while [ "$OK" != "Y" ]
do
echo "Enter owner? (default \"$MLOGNAME\")"
read owner
: ${owner:=$MLOGNAME}
echo "Enter group? (default \"group\")"
read group
: ${group:="group"}
echo "Enter permissions (default 666)"
read perm
: ${perm:="666"}
echo $owner $group $perm
echo "All OK?"
read OK
if test -z $OK
then
OK=Y
fi
case $OK in
        [Yy]) : ;;
        *) continue ;;
esac
for i in $dfiles
do
chown $owner $i
chgrp $group $i
chmod $perm $i
done
done

fi

}

DownScreen() {
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
}
DosSubDir() {
for i in `grep "<DIR>" /tmp/dosd$$ | sed "s/\(.*\) <DIR>.*/\1/" | sed "s/  */\./"`
do
echo $i "Examine (YNQ)"
read akey
        case $akey in
        [Yy]) ShowDos $i ;;
        [Qq]) return ;;
        *) : ;;
        esac
done

}
ShowDos() {
clear
DownScreen
dosdir /dev/rfd0135ds18:/$1 | tee /tmp/dosd$$ | more -w
rm -f /tmp/dosd$$
return
if grep "<DIR>" /tmp/dosd$$ > /dev/null
then
echo ""
echo ""
echo "  Examine Subdirectories of Dos Disk (Y/N)"?
read akey
        case $akey in
        [Yy]) DosSubDir ;;
        *) : ;;
        esac
fi
rm /tmp/dosd$$

}
ShowUnix() {
(echo " Current Directory is `pwd`\n";ls -l) | more -w
}
ChangeDir() {
clear
DownScreen
echo "Enter Directory (blank for your HOME directory)"
read todir
cd $todir
test -w .
if [ $? != 0 ]
then
echo "Cannot create files in this directory"
echo "Press Enter"
read ak
fi
test -r .
if [ $? != 0 ]
then
echo "Cannot read files in this directory"
echo "Press Enter"
read ak
fi

}
CopyFiles() {
clear
DownScreen
echo "  Current Directory is `pwd`\n"
echo "  (1) Copy TO Dos"
echo "  (2) Copy From Dos"
echo "  (Q) Quit"
read akey
        case $akey in
        1) ToDos ;;
        2) FromDos;;
        [3qq]) return ;;
        esac
}
if test -z "$LOGNAME"
then
set `who am i`
MLOGNAME=$1
LOGNAME=$1
else 
MLOGNAME=$LOGNAME
fi
while true
do
clear
DownScreen
echo "  Current Directory is `pwd`\n"
echo "  Dos Transfers"
echo "  (1) Show Files on Dos Disk"
echo "  (2) Show files on Unix Drive"
echo "  (3) Change to another directory"
echo "  (4) Copy files"
echo "  (Q) Quit"
read akey
case $akey in
        [5Qq]) exit 0;;
        [1]) ShowDos / ;;
        [2]) ShowUnix ;;
        [3]) ChangeDir ;;
        [4]) CopyFiles ;;
esac
done




Got something to add? Send me email.





Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





When someone says: "I want a programming language in which I need only say what I wish done", give him a lollipop. (Alan J. Perlis)

The man who receives five thousand dollars a year wants six thousand dollars a year, and the man who owns eight or nine hundred thousand dollars will want a hundred thousand dollars more to make it a million, while the man who has his millions will want everything he can lay his hands on and then raise his voice against the poor devil who wants ten cents more a day. (Samuel Gompers)












This post tagged: