Those of you who have or use a shell account, may lament the clumsiness
of ftp in CUTCP or NSCA telnet for file transfers, compared to commands like
sz (zmodem) that are available in windows versions of telnet.
However, there is a way to simplify ftp file transfers so that they
approach the simplicity of a command like: sz filename.
Ftp has a limited macro capability, allowing you to define an initial
macro of several ftp commands that will be automatically executed when
you start ftp. You place the macro in a file called, .netrc, which
contains initial lines defining a machine and a login/password combination
that you might ftp to. Ftp then executes the macro whenver you ftp to that
machine. Therefore if you can get the dynamic IP address of your PC and
your random CUTECP password into .netrc, you dcan efine a macro with all the
file transfer commands to upload or download files to/from your pc.
I do this by setting a shell veriable called ``Boot'' to my IP address
and password (e.g., setenv Boot IP-address/password) whenever I telnet into
my shell account. Then the following
shell script will create a zmodem-like download command:
----------------------------begin Download------------------------
#!/bin/csh -f
onintr end
unalias rm
set boot = $Boot
echo "machine $boot:h\
login theo\
password $boot:t\
macdef init\
binary\
mput $argv\
bye\
" > $HOME/.netrc
chmod 0600 $HOME/.netrc
ftp $boot:h
foreach file ($argv)
echo -n "remove $file (y/n)"
set yes = $<
if $yes == "y" rm $file
end
end:
rm $HOME/.netrc
-------------------------------------End Download--------------------------
Now the simple command:
download file1 file2 file3 <ENTER>
will download files file1, file2, and file3 to your PC, in binary mode,
and then prompt you to remove each file from the shell, if desired.
There are some variations on this idea, such as using the telpass program
to define a password that is not random and does not vary between sessions.
I use the macro language of CUTCP to get the Boot variable defined.
One can also extend this idea to, for instance, run Pine from your
shell and save messages directly to your PC with one keystroke.
Anyone who is interested in or needs to know more details on this, give
me an email. I expect many will be able to fill in the blanks once they
get the idea.
__________________________
Howard Schwartz
theo "at" ncal.verio.com