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.



Some material is very old and may be incorrect today

© December 1997 Tony Lawrence

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



If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Unix Programs: cpdos


Inexpensive and informative Apple related e-books:

Take Control of iCloud

Take Control of Parallels Desktop 12

Photos for Mac: A Take Control Crash Course

Take Control of Automating Your Mac

Take Control of Numbers





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

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


Printer Friendly Version





The only problem with the cloud is that at some point it will rain. (Reinhard Posch)




Linux posts

Troubleshooting posts


This post tagged:

Code

Scripting



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode