DIGITAL TCP/IP Services for OpenVMS
User's Guide


Previous Contents Index

2.1 Typing FTP Commands

Use the following rules for command syntax, quotation marks, and wildcards when you type FTP command lines.

2.1.1 DCL and UNIX Command Formats

With the FTP command and most of the commands at the FTP prompt, you can use either DCL-style or UNIX style syntax. For example, the DCL-style DIRECTORY and UNIX style ls commands produce the same results, as shown in the following example:


FTP> DIRECTORY/BRIEF *.DIR 
200 PORT command successful. 
150 Opening data connection for WORK1$:[VANA]*.DIR;* (130.180.4.8,1797) 
BIN.DIR;1 
MAIL.DIR;1 
NEWS.DIR;1 
NSLOOKUP.DIR;1 
USER.DIR;1 
 
226 NLST Directory transfer complete 
63 bytes received in 00:00:00.02 seconds (2.12 Kbytes/s) 
FTP> ls *.dir 
200 PORT command successful. 
150 Opening data connection for WORK1$:[VANA]*.DIR;* (130.180.4.8,1798) 
BIN.DIR;1 
MAIL.DIR;1 
NEWS.DIR;1 
NSLOOKUP.DIR;1 
USER.DIR;1 
 
226 NLST Directory transfer complete 
63 bytes received in 00:00:00.03 seconds (2.05 Kbytes/s) 
FTP> 

2.1.2 Quotation Marks

When you communicate with a non-OpenVMS host, you need to enclose the following with quotation marks:

In the following example, UNIX path names need quotation marks around them:


FTP> put MY.DOC "/usr/users/evt/my.doc" 
200 PORT command successful. 
150 Opening ASCII mode data connection for /usr/users/evt/mydoc (130.180.4.8,1 
789). 
226 Transfer complete. 
local: WORK1$:[VANA]MY.DOC;2  remote: /usr/users/evt/my.doc 
289 bytes sent in 00:00:00.01 seconds (20.15 Kbytes/s) 
FTP> 

2.1.3 Wildcards

You can use wildcards in the following FTP commands: DELETE, DIRECTORY, GET, PUT, MGET, MPUT, MDELETE, and MLS.

The wildcard characters recognized by FTP are:

If any of these characters are part of a file name (not used as a wildcard), you can disable recognition of these characters as wildcards by either enclosing the file name in quotation marks or using the DISABLE PARSE command.

2.1.4 Qualifiers

In a DCL-style command line, you can place a command qualifier anywhere on the command line. It is a good practice to follow the OpenVMS recommendation to place the qualifier after the command name.

In the following example, all three forms of the GET command are correct.


FTP> GET TEMP. *.* /CONFIRM           (1)
FTP> GET /CONFIRM TEMP. *.*           (2)
FTP> GET/CONFIRM TEMP. *.*            (3)
Get TEMP. ? [Y or N ] [Y]:Y 
200 TYPE set to IMAGE. 
200 PORT command successful. 
150 Opening data connection for TEMP. (130.180.4.8,2634) 
226 Transfer complete. 
local: WORK10$:[MILGROM]TEMP.;13  remote: TEMP. 
153 bytes received in 00:00:00.01 seconds (9.33 Kbytes/s) 
FTP> 

  1. The /CONFIRM qualifier follows the file name parameters rather than the GET command.
  2. The /CONFIRM qualifier follows the GET command, but with a space between the command and the qualifier.
  3. The /CONFIRM qualifier immediately follows the GET command. FTP prompts the user to confirm that file TEMP. is to be copied and then sends a copy of the file from the remote host.

2.2 Obtaining Online Help

You can obtain online help for the FTP utility and FTP commands by typing any one of the following commands:

To obtain information about a specific command, specify the command as in the following examples:

2.3 Starting FTP Sessions

You can start an FTP session in any of the following ways:

You must connect to a remote host before you can enter an FTP command that affects or displays files on the remote host. You can invoke FTP and, without connecting to a remote host first, enter the FTP commands that customize the FTP environment.

2.3.1 Making a Remote Connection

When you establish an FTP connection, the remote user name defaults to your user name on the local system.

If you have a different user name on the remote system, do one of the following:

If your connection is with another OpenVMS host, it executes your LOGIN.COM procedure. You can use your LOGIN.COM command procedure to customize the environment for your FTP sessions.

The following example connects to host XENO using the FTP command:


$ FTP XENO /USER="bennings" /PASSWORD="keysimpl"[Return]
220 xeno FTP Server (Digital UNIX Version 5.60) ready 
Connected to XENO.site1.acctg.com. 
230 User logged in 
FTP>

In the following example, user dave invokes FTP and connects to UNIX host sanfran using the CONNECT command:


$ FTP [Return]
FTP> CONNECT SANFRAN [Return] 
220 sanfran.golden.com FTP server (Digital UNIX Version 5.60) ready 
Connected to sanfran.golden.com. 
Name (sanfran:dave): [Return] 
331 Password required for dave 
Password:              (password not echoed) [Return]
230 User logged in 
FTP>

2.3.2 Anonymous User Access (Anonymous FTP)

Anonymous user access, also called Anonymous FTP, lets you make an FTP connection to a remote host by specifying the name ANONYMOUS (or another name defined by the system manager). With Anonymous FTP, you do not need:

With Anonymous FTP, you can:

In the following example, UNIX user williams uses Anonymous FTP to connect to the ANONYMOUS account on OpenVMS host TRACTPLAN. Rather than prompting for a password, TRACTPLAN asks for the user name.


% ftp tractplan 
Connected to tractplan.green_dev.org. 
220 tractplan FTP Server (Version 5.0) ready 
Name (tractplan:williams): anonymous 
331 Guest login ok, send ident as password 
Password: williams@tractplan.edu
230  Guest login ok, access restrictions apply 
 
     WELCOME to DIGITAL TCP/IP Services for OpenVMS 
             on Internet Host TRACTPLAN 
                  Date 04-24-97 
FTP> 

2.4 Exiting FTP

You can end an FTP session and return to the DCL prompt with any of the following commands: EXIT, quit, or Ctrl/Z. The following examples close the connection with the remote host, if one is open, and exit FTP.


FTP> EXIT
221 Goodbye. 
$


FTP> quit
221 Goodbye. 
$

If however, you want to close a connection while remaining at the FTP prompt, use the DISCONNECT or close command.

The following examples close a connection, if one is open, and remain at the FTP prompt for you to continue using FTP.


FTP> DISCONNECT
221 Goodbye. 
FTP>


FTP> CLOSE
221 Goodbye. 
FTP>

2.5 Viewing Directories on the Remote Host

Use the DIRECTORY command to list the files and associated information in remote directories. For example, the following command lists the files in the default directory on a remote UNIX host (assuming the user already has connected to the remote host):


FTP> DIRECTORY
200 PORT command successful 
150 Opening ASCII mode data connection for /bin/ls (130.180.4.8,1312) 
total 6303 
-rw-rw-r--   1 milgrom  users          1 Jan  9  1996 #UNTITLED# 
-rw-------   1 milgrom  users          4 Apr 11  1996 .Xauthority 
-rwxr-xr-x   1 milgrom  users       1499 Feb  3  1995 .cshrc 
drwxr-xr-x  11 milgrom  users       8192 Jan  9  1996 .dt 
-rwxr-xr-x   1 milgrom  users       3970 Dec 13  1995 .dtprofile

2.6 Displaying and Changing the Default Directory

During an FTP session, you can display or change the current default directory either on the remote host or on your local host.

To display the default (working) directory on the remote host, use the SHOW DEFAULT command as in the following example:


FTP> SHOW DEFAULT 
257 "/usr/users" is the current directory.

To display the working directory on the local host, use the SHOW DEFAULT command with the /LOCAL qualifier, as in the following example:


FTP> SHOW DEFAULT/LOCAL 
Local directory is DISK$6:[MANAGER].

To change the default directory on the remote host, use the SET DEFAULT command. The following example shows how to change the default directory on a remote DIGITAL UNIX host to /usr/users/robert:


FTP> SET DEFAULT "/usr/users/robert"
250 CWD command successful. 

or


FTP> SET DEFAULT "~robert" 

To change back to your login default directory, specify a tilde (~) alone, as follows:


FTP> SET DEFAULT ~
250 CWD command successful.
FTP> pwd
257 "/usr/users/robert" is current directory.

This next example changes the remote working directory from /usr/flyers/localads to /usr/flyers/localads/music:


FTP> SET DEFAULT MUSIC 

To change the default directory on your local host, use the SET DEFAULT command with the /LOCAL qualifier. The following example sets the local default directory to USER$1:[PLANS.CHECKS]:


FTP> SET DEFAULT/LOCAL USER$1:[PLANS.CHECKS] 
Local Directory now USER$1:[PLANS.CHECKS] 

This next example changes the local OpenVMS default directory down one level from [DECK] to [DECK.HEARTS]:


FTP> SET DEFAULT/LOCAL [.HEARTS] 

2.7 Creating and Deleting Directories

To create a directory on a connected remote host, use the CREATE/DIRECTORY command. The following command example creates a subdirectory .LOCAL_ACCTS in the current working directory on the connected remote OpenVMS host.


FTP> CREATE/DIRECTORY [.LOCAL_ACCTS]

To delete a directory, use the DELETE/DIRECTORY command as in the following example. The command deletes the directory created in the preceding example.


FTP> DELETE/DIRECTORY LOCAL_ACCTS.DIR;*

2.8 Copying Files

To copy files from a remote host to your local host, use the GET command. To copy files from your local host to a remote host, use the PUT command. To use these commands, you must have an active FTP session with a remote host. You can enter any number of commands during the session. For information on using these commands to copy files to and from a remote DECnet host, see Section 2.15. You can also use the COPY/FTP command to copy files across the network using TCP/IP. For more information on this command, type HELP COPY/FTP at the DCL prompt.

2.8.1 Using the GET Command to Copy Remote Files to the Local Host

Use the GET command to copy one or more files from a remote host to your local host. For example, to copy the UNIX file acct.pay, located in the remote working directory, to your local OpenVMS host, use the following command:


FTP> GET ACCT.PAY

Figure 2-1 The GET Command


As shown in Figure 2-1:

  1. The user at the local host named Host A, and connected through FTP to the remote UNIX host named hostx, enters a GET command.
  2. The FTP client software on Host A sends a request to the remote FTP server on hostx to send the requested file.
  3. The FTP PORT command successful message and the following line indicate the remote server is opening a data connection to send the requested file.
  4. The remote FTP server sends the requested file, acct.pay, to Host A.
  5. A message indicates the file transfer was complete and provides additional information about the transfer.

For more information on the GET command, see Section 2.16.

2.8.2 Using the PUT Command to Copy Local Files to the Remote Host

Use the PUT command to copy one or more files from your local host to a remote host. For example, the following command copies the local file ACCTS.LIS to a connected remote UNIX host. Use the /FDL qualifier to prevent record attributes from being lost in the transfer from OpenVMS to UNIX systems. For more information on the /FDL qualifier, see Section 2.8.5.


FTP> PUT ACCTS.LIS

Figure 2-2 The PUT Command


As shown in Figure 2-2,

  1. The user at local host Host A, and connected through FTP to the remote UNIX host hostx, enters a PUT command.
  2. The FTP client software on Host A requests the FTP server on hostx to receive the specified file (accts.lis).
  3. The remote FTP server establishes a data connection with the local host.
  4. The PORT command successful message and the following line indicate the remote server will receive the file.
  5. The client sends the requested file, accts.lis, to hostx.
  6. A message indicates the file transfer is complete and provides additional information about the transfer.

For more information on the PUT command, see Section 2.16.

2.8.3 How FTP Copies Files

FTP resolves the differences between UNIX file systems and OpenVMS file systems automatically. By default, the PUT command copies files to UNIX systems using lowercase file names without version numbers. If you use a wildcard to copy all versions of a file and do not specify an output file:

2.8.3.1 Store Unique

The Store Unique (STOU) feature allows you to control how file version numbers are treated when you copy (PUT) files from local to remote hosts. After connecting to the remote host, you toggle the Store Unique feature on and off by issuing the sunique command at the FTP prompt, as follows:


 FTP> sunique 
 Store unique on. 
 FTP> sunique 
 Store unique off. 
 FTP> sunique 
 Store unique on. 

The Store Unique feature behaves differently when copying files from OpenVMS to UNIX or from UNIX to OpenVMS. It also behaves differently if you use wildcards or specify version numbers. For example, the results vary when you copy the file text.txt as follows:
FTP Command Store Unique On Store Unique Off
From OpenVMS to UNIX
FTP> PUT text.txt text.txt text.txt
FTP> PUT text.txt;1 text.txt.1 text.txt.1.1
FTP> PUT text.txt;* text.txt.1
text.txt.2
text.txt.3
text.txt.1.1
text.txt.2.1
text.txt.3.1

2.8.4 Transfers Between OpenVMS Hosts: VMS Plus Mode

FTP performs fast file transfers between two OpenVMS systems (VMS Plus Mode).

When FTP identifies file transfers between two OpenVMS hosts running DIGITAL TCP/IP Services for OpenVMS, it transfers files in large blocks, rather than small records. VMS Plus Mode greatly increases the transfer speed and preserves all Record Management Services (RMS) file attributes.

FTP automatically disables VMS Plus Mode when your session is with a UNIX host or another OpenVMS host not running DIGITAL TCP/IP Services for OpenVMS.

2.8.5 Preserving OpenVMS File Attributes

When you transfer OpenVMS files to a UNIX system and back again, some record attributes might be lost. To preserve all RMS file attributes, use the /FDL qualifier (File Definition Language) with the GET and PUT commands.

You may also need to use the SET TYPE command to determine the type of file transfer:

For example, to transfer an executable image to a remote UNIX host, follow these steps:

  1. Specify the IMAGE data type:


    FTP> SET TYPE IMAGE
    

  2. Transfer the file to the remote host while at the same time creating and transferring a secondary file with the file's OpenVMS record attributes:


    FTP> PUT/FDL file
    

To retrieve the file from the remote UNIX host, follow these steps:

  1. Specify the IMAGE data type:


    FTP> SET TYPE IMAGE 
    

  2. Retrieve the file from the remote host after retrieving and using the secondary file containing the file's OpenVMS record attributes:


    FTP> GET/FDL file.dat 
    

In this example, the PUT/FDL command does the following:

In this final example, the GET/FDL command does the following:


Previous Next Contents Index