APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS














(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



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





Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar

cartoon
Versatile Site Map Generator $59.00
Buy A1 Sitemap Generator


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. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server




pavatar.jpg
More:
       - Code


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress