H.2. Sending and Receiving Files
Most communications programs invoke rz and sz automatically. You can also connect to a remote system, log in, and manually invoke sz with the flags you want to use. Zmodem automatically downloads the files to your home system using the same filenames. (Zmodem tools aren't clever about filenames, so when you download to MS-DOS, be careful about getting files with names that can't be squeezed into the filename.ext DOS filename limit. If you transfer filename.extension, it arrives on your DOS host converted to filename.ext, which is probably OK. But, if you try to transfer filename.more.extension, most Zmodem utilities will give up, probably with a misleading message that the transfer completed.)
One of the most confusing things about Zmodem transfer is determining the command to use to perform the transfer. You have to remember which system you are invoking the command from and which system contains the files to transfer. A consistent way to perform Zmodem transfer is to always invoke the transfer on the remote host, whether uploading (sending to the remote host) or downloading (receiving from the remote host). For example, if you are logged in to a remote host (using C-Kermit, or Telix, or whatever) and want to send some text files from that system to your home system, you might enter something like this:
sz would queue the files and successively send them back to the local system. The -a option stands for ASCII and ensures that carriage returns and newlines appear as they should on the system where the file ends up.$ sz -a *.txt
On the other hand, if you want to upload some files (receive them on the remote host), you would simply enter the following command:
The remote system would then prompt something like this:$ rz
rz waits patiently for you to switch back to the local host and give it a Zmodem send command, using sz directly, or through the software you are using. For example, if you call the remote host using ProComm, you would press Page Up and select Zmodem transfer from the pop-up menu and then enter the files to send on the input line ProComm provides.rz ready to begin transfer, type "sz file " to your modem program **B0100000023be50
When sending files from a Macintosh system to a Unix or Linux host via Zmodem protocol, remember that the filenames cannot have spaces in them.
The following command checks some text files and sends only the .txt and .doc files that exist on both systems and that are newer on the sending system. Conversion of Unix newlines to DOS-style carriage return/linefeed is performed automatically by most receiving Zmodem packages:
$ sz -Yan *.txt *.doc
In many versions (not all, unfortunately) you can pipe the output of a process from a remote host to sz using a dash argument (sz -), and sz automatically sends the file on to you. A filename for the output is generated by putting an s in front of the process ID of the process that pipes the standard input to sz and appending a .sz suffix. For example, to get a printout of the sz.1 manual page on the remote system (versions of sz software vary, of course), you might enter:
where col -b strips out the backspacing that was put into the formatted output by the man command to implement highlighting and underscoring on the display. The dash argument to sz tells it to send the file back to your local system. When you get offline and check, you might find the file saved locally as something like /tmp/s7750.sz. (the /tmp directory is the most common receiving directory that a given communications program uses unless the current directory is used.)man sz | col -b | sz -
Copyright © 2001 O'Reilly & Associates. All rights reserved.