
Tips and techniques for exchanging files between Unix and DOS,
MacOS, or VMS systems with FTP
By Becca Thomas
Long gone are the days when a computing shop used all the same
systems. Now, sprinkled among the high-powered workstations and
VMS-based minis on your network are various DOS and Windows PCs
and Apple Macintoshes. The trick is to allow easy exchange of
files between the divergent systems.
TCP/IP protocols not only allow you to copy files between
different Unix system variants, but also between Unix and other
operating systems, such as DOS, MacOS, and VMS, among others.
This month we look at some tips and techniques for moving files
between some of these operating-system environments with the file
transfer protocol (FTP).
Dear Dr. Thomas:
One of the common problems in computing is transferring files
between different platforms, say between a Unix-based workstation
and either a PC running DOS or a VMS-based VAX minicomputer.
Although FTP has made such transfers possible, you still need to
know about the pitfalls associated with different file-naming
schemes.
DOS <-> Unix
[Doctor's notes: DOS files are named with a disk-
device designator, which is a single letter followed by a colon,
then the file name with up to eight characters, and lastly an
optional extension, consisting of a dot and up to three
characters (also known as the ``8+3 rule''). Listing 1A shows this format. The
backslash (\) character separates directories and
file names in a DOS path name, as in C:\U\WERNER or
its equivalent c:\u\werner. Letter case is not
significant. Generally, DOS-based FTP servers translate case-
sensitive Unix file names into case-insensitive DOS names during
file transfers. These servers also have to truncate longer Unix
file names to fit the 8+3 rule.]
Always use ``binary'' mode to transfer files containing control
characters and eight-bit data such as compiled programs,
compressed data, or other nontext data files. Use ASCII mode for
text files, like Postscript programs. The DOS server should also
translate carriage-return, line-feed terminators used in DOS text
files to use the Unix newline terminator and vice versa.
Listing 1B shows that the FTP
dir command yields a directory listing like that
obtained with the DOS DIR command. Here, we log
into the DOS server on system da2, run the FTP
pwd command to display the path name of the current
directory (the \U subdirectory on the ``C'' hard-
drive volume), then list that directory.
To request files from another volume, use the FTP cd
command to select that volume. For instance, enter
cd a: to select diskette drive A. The
DOS server will change the working directory to the diskette
drive. Just be sure to have a diskette inserted in the drive
before selection or the DOS server might crash. If it does, try
to start up the server or reboot the system if it is hung.
MacOS <-> Unix
Unlike DOS, the Macintosh operating system doesn't separate
the disk volume designator through a special syntax. A disk has
a name like a directory or a file where the components are
separated by colons (:) Listing 2A shows the general
format. Here's a specific example:
Aktenschrank:The Beauty of Fractals Lab:Old Demos:Demo1
where Aktenschrank is the name of the hard disk,
The Beauty of Fractals Lab and
Old Demos are directories, and
Demo1 is the file name. The length of the file name
is not as limited as in DOS.
Unfortunately, when transferring MacOS binaries to some other
architecture, the files will be corrupted even if you set the
transfer mode to binary. You have to set ``MacBinary mode'' to
transfer these files successfully. There should be a
corresponding option on any file-transfer program running under
MacOS, such as NCSA's (National Center of Supercomputing
Applications) public-domain Telnet/FTP implementation.
MacOS file names can include punctuation characters and even
spaces, which present a problem. Enclose whitespace characters
in quotes and rename MacOS files--whose names include shell
metacharacters--to legal Unix file names. Listing 2B shows a sample interactive
file-transfer session.
VMS <-> Unix
[Doctor's notes: Listing
3A shows the general format of a VMS file name: the
node name is a one- to six-character
identifier of a computer system in a DECnet network; the four- to
seven-character device name indicates the
physical location where the file is stored, such as magnetic or
optical disk; the directory name is a 1-
to 39-character identifier that names the directory containing
the file; the 1- to 39-character
extension is generally used to indicate
the type of file; and the version number
is an integer in the range between 1 and 32,767.]
For file transfers you'll generally work with VMS files named
with a disk designator, directory name, file name, optional
file-extension name, and version number. For instance,
DUA0:[ROHDATEN]ZSSN.RMB;1 denotes the first version
of the file named ZSSN with extension
RMB on the DUA0 disk in directory
ROHDATEN.
Several standard extensions are used to denote the type of
file, such as DIR for directory files,
TXT for human-readable text, EXE for
executables, and COM for command files. Although
VMS maintains previous versions of a file, hence the version
number, you can ignore it and VMS will hand you the latest
version or you can specify an earlier version by number, but be
sure to rename the file if it's destined for a Unix system so the
semicolon doesn't become part of the file name. Also, you should
remove or translate other shell metacharacters, such as the
square brackets.
Part B of Listing 3 shows a
sample directory listing. The numbers separated by a slash
(/) denote the file size: the first is the number of
512-byte blocks used out of the total allocated, which is
specified by the second number. All the files shown have used 17
out of 18 blocks. Next the creation date and time is displayed.
Note that the details of your display may differ, such as the
order of the fields. Or perhaps it has additional information,
such as the file-access modes.
Use the FTP cd command to change to another
directory. VMS directories look like any other file except for
the .DIR file-name extension. However, you'll omit that
extension when changing directories. Unfortunately, there are
two distinct ways to represent multiple directory levels. One
uses the Unix ``slash'' notation, as in a/b/c, but
the other uses dots as in [a.b.c]. Many servers
don't recognize dot-dot (..) as the parent
directory, so you'll need to use
cd [.-], cd [-],
or the cdup command to move up one directory level.
If you're using the dot-style syntax, be sure to include the
dot for a subdirectory of your current directory, as in
cd [.filetrans], or the server assumes
filetrans is in the top-level (root) directory for
the current disk. Letter case isn't significant, so you could
enter cd [.FILETRANS] or even
cd [.FiLeTrAnS] to move down one level
to the FILETRANS.DIR subdirectory. Listing 3C shows some examples.
FTP servers provide the ntrans command that lets you specify
translation of characters in file names when copying files. Listing 3D shows an example. Here we
translate the first character in the input-character string
(;[]:) to a dot, but remove the others by
translating them to nothing because there's no corresponding
output character specified. The subsequent file-retrieval
request shows that DUA0:[ROHDATEN]ZSSN.RMB;1 is
translated to DUA0ROHDATENZSSN.RMB.1.
It's crucial to transfer ASCII files in mode ASCII because VMS
files have more attributes than Unix files, so you might end up
with your file being truncated, missing the line-terminator
characters, or having some other corruption.
Proxy Transfers
If you want to transfer files between two remote hosts, you
can use the proxy command, which comes in handy when
your local network is behind a firewall machine. You could log
onto your account on the firewall and then use the FTP
proxy command to copy files from the Internet onto
your machine behind the firewall. When you ``open'' a
connection, it will be the primary connection to your commands'
destination. If you then open a proxy connection with
proxy open other.host, you
have a virtual connection between your primary host and
other.host. If you tell the proxy host to get a file from the
primary host, you have to type in proxy get
filename as shown [in Listing 4]. You
can use any FTP command the proxy host understands.
Axel Eble / Albert Ludwigs University / Freiburg, Germany
Tester's Comments
- NT uses drive letters similar to DOS, but the NT file system
itself looks more like Unix. If you use NT with the DOS file
system (the Microsoft code name is FAT file system), the server
uses case-insensitive 8+3 names.
Use the quote site dirstyle command to
switch the directory listing (dir command) output
format between Unix or DOS styles. The default format is
configuration dependent. Note that the
ftp.microsoft.com host (also known as
gowinnt.microsoft.com) uses the Unix
ls -l listing style when you log in,
whereas DOS style is used for an out-of-the-box system. The
quote site ckm command toggles the
cd command's verbose mode.
Novell Netware uses volumes instead of drive letters. Normally,
all Netware servers have a SYS volume, but that may
be unreadable. Additional volumes are named
VOLN by default, but may be renamed by
the administrator. Case-insensitive 8+3 DOS file names are used
by default, but NFS or MacOS name spaces are available.
When the local system is DOS, Windows NT with DOS file system, or
System V before Release 4, don't forget to rename long names when
retrieving files from remote BSD, SVR4, Windows NT with NT file
system, or MacOS file systems. Otherwise the file name will be
truncated without notice, which may cause overwriting of files
using multiple ``get'' (mget) commands.
Novell sells FTP servers in two packages: Netware NFS and Netware
FLEXIP. I began setup of the FTP server for the NFS product. The
FTP server (FTPSERV.NLM) is inetd-daemon based
(INETD.NLM).
Although Netware normally uses DOS-style file names, it can
support Unix-like (NFS.NAM), MAC-like
(MAC.NAM), and OS2-like (OS2.NAM) file
names. We don't use the Unix-compatible names at our facility
because it slows down the mounting of the Netware volumes
significantly.--Endre Bálint Nagy, Walton Networking
Ltd., Budapest, Hungary
- I browsed through the header files of a few Unix utilities
used to unpack MacOS archives, and there doesn't seem to be
file-name-length consensus: I've seen 32-bytes, 64-bytes, and
255-bytes defines.
You can change Netware volumes with the change directory command,
as in:
cd volumename:/dirname
much like it works with DOS, except you have to type a name
instead of one letter. Also, there's no way to find out the
volume names if you don't know them. My guess is that it holds
true for VMS devices and MacOS disk names also because there is
no single ``root'' directory at the top of the hierarchy. Unlike
Unix, the Netware FTP daemon displays permissions you
have.
Some tests I ran included logging in from an SCO Unix ODT 3.0
system to a PC running Desqview/X on top of DOS 6.2, using
Desqview's FTP daemon. All went well, even connecting back to
the ODT box using proxy. Then, I logged in from the
same Unix box to a Novell Netware 3.11 server, using Murkworks
Inc.'s FTP server (NLM-based). The file names look similar to DOS
file names but have a volume name prefixed instead of a
one-letter device name. Murkworks' FTPD.NLM also
supports proxy connections.--Kees Hendrikse, Echelon
Consultancy, Enschede, The Netherlands
- Most of our campus users employ DOS/Windows FTP clients that
automatically deal with Unix file names (truncating them as a
rule). Few people allow FTP into their PC because they're shut
off at night. More importantly, some packages don't require a
password to access the FTP server, although that can be
configured.--Mike Peterson, System Administrator, Department
of Chemistry, University of Toronto, Canada.
|