Compaq TCP/IP Services for OpenVMS
User's Guide


Previous Contents Index

2.1 Using FTP Commands

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

2.1.1 DCL and UNIX Command Syntax

With the FTP command and most of the commands at the FTP prompt, you can use either DCL or UNIX command syntax. For example, the DCL DIRECTORY and the UNIX 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) 
 

2.1.2 Quotation Marks

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

As shown in the following example, enclose UNIX path names with quotation marks:


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) 
 

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 include the following:

If any of these characters are part of a file name but are 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 DCL command lines, you can place a command qualifier anywhere on the command line. It is a good practice to follow the OpenVMS recommendation of placing the qualifier after the command name.

In the following example, all three uses 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, with no space between the two. 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 service and FTP commands by typing any of the following commands:

To obtain information about a specific command, specify the command as shown 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 first connecting to a remote host, 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 (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 (UNIX Version 5.60) ready 
Connected to sanfran.golden.com. 
Name (sanfran:dave): [Return] 
331 Password required for dave 
Password:            [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 perform the following actions:

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


% ftp tractplan 
Connected to tractplan.green_dev.org. 
220 tractplan FTP Server (Version 5.1) ready 
Name (tractplan:williams): anonymous 
331 Guest login ok, send ident as password 
Password: williams@tractplan.edu 
230  Guest login ok, access restrictions apply 
 

2.4 Exiting FTP

You can end an FTP session and return to the DCL prompt by entering the EXIT, quit , or bye commands or by pressing Ctrl/Z. The following examples close a connection with the remote host and exit FTP.


FTP> EXIT 
221 Goodbye. 
$ 


FTP> quit 
221 Goodbye. 
$ 

To close a connection and remain at the FTP prompt, use the DISCONNECT or close command.

The following examples show how to 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  2002 #UNTITLED# 
-rw-------   1 milgrom  users          4 Apr 11  2002 .Xauthority 
-rwxr-xr-x   1 milgrom  users       1499 Feb  3  2002 .cshrc 
drwxr-xr-x  11 milgrom  users       8192 Jan  9  2002 .dt 
-rwxr-xr-x   1 milgrom  users       3970 Dec 13  2002 .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 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. 

The following 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] 

The following 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 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, the following command copies the UNIX file acct.pay , located in the remote working directory, to your local OpenVMS host:


FTP> GET ACCT.PAY 

Figure 2-1 The GET Command


Figure 2-1 shows the following:

  1. The user at local host hosta , who is connected through FTP to remote UNIX host hostx , enters a GET command.
  2. The FTP client software on hosta 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 hosta .
  5. A message indicates the file transfer was complete and provides additional information about the transfer.

For more information about 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:


FTP> PUT ACCTS.LIS 

To prevent record attributes from being lost in the transfer from an OpenVMS to a UNIX system, use the /FDL qualifier to the PUT command. For more information about the /FDL qualifier, see Section 2.8.5.

Figure 2-2 The PUT Command


Figure 2-2 shows the following:

  1. The user at local host hosta , who is connected through FTP to remote UNIX host hostx , enters a PUT command.
  2. The FTP client software on hosta 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 about 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, the following occurs:

2.8.3.1 Store Unique Feature

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 between OpenVMS and UNIX. It also behaves differently if you use wildcards or specify version numbers.

The following table shows the results when you copy the file text.txt from OpenVMS to UNIX.
FTP Command File test.txt Exists on UNIX System Store Unique On Store Unique Off
FTP> PUT text.txt No text.txt text.txt
FTP> PUT text.txt Yes text.txt.1 text.txt

The next table shows the results when you copy the file text.txt;* from OpenVMS to UNIX.
FTP Command Files test.txt.1 test.txt.2 Exist on UNIX System Store Unique On Store Unique Off
FTP> PUT text.txt;* No text.txt.2
text.txt.1
text.txt.2
text.txt.1
FTP> PUT text.txt;* Yes text.txt.2.1
text.txt.1.1
text.txt.2
text.txt.1

2.8.4 Transferring Files Between OpenVMS Hosts: VMS Plus Mode

FTP performs fast file transfers between two OpenVMS systems by using VMS Plus Mode.

When FTP identifies file transfers between two OpenVMS hosts running TCP/IP Services, it transfers files in large blocks rather than in 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 with an OpenVMS host not running TCP/IP Services.


Previous Next Contents Index