VMS Help
TCPIP Services, FTP

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    FTP - the File Transfer Protocol - allows you to connect to a
    remote host and:

    o  Transfer files between your local host and the connected
       remote host

    o  Append local files to remote host files

    o  Delete and rename files on the remote host

    o  Create, delete, and rename directories on the remote host

    o  View the contents of directories and files on the remote host

    FTP also allows you to set and display the default working
    directory on the remote host as well as on your local host, and
    to customize FTP command processing.

    You can also use RCP to copy files. For more information on RCP,
    see Remote_Commands.

    To use FTP, you need the following:

    o  A user account on the OpenVMS system with access to DIGITAL
       TCP/IP Services for OpenVMS

    o  One of the following:

       -  A user account on the remote FTP host

       -  Access to the remote host's ANONYMOUS user account

  1 - Command Summary

    To use FTP, enter the commands summarized below. For complete
    descriptions (including UNIX equivalents) of each command, type
    the following:

    $ FTP

    FTP>HELP

    Command               Description

    Starting and Exiting (At the DCL Prompt)

    FTP                   Invokes FTP
    FTP remote_host       Invokes FTP and establishes a connection to
                          a remote host

    Starting and Exiting (At the FTP> Prompt)

    CONNECT               Establishes a connection to a remote host
    DISCONNECT            Closes the connection with the remote host
    EXIT                  Closes the connection with the remote host
    Ctrl/Z                and exits FTP

    Sending Commands to the Remote Host

    APPEND                Appends a local file to a remote file
    CREATE/DIRECTORY      Creates a remote directory
    DELETE                Deletes remote files
    DIRECTORY             Lists remote file names and related
                          information
    GET                   Copies files from the remote host to the
                          local host
    LOGIN                 Logs you in to a remote host
    PUT                   Copies files from the local host to the
                          remote host
    RENAME                Renames remote files
    SET DEFAULT           Sets the remote working directory or the
                          local working directory
    SHOW DEFAULT          Displays the name of the current working
                          directory
    VIEW                  Displays the contents of a file on the
                          current output device.

    Suspending FTP to Return to DCL Prompt

    SPAWN                 Suspends FTP to create a subprocess at the
                          local DCL prompt

    Customizing Your Session's Environment

    DISABLE LOG           Disables the display of all the protocol
                          commands sent to the remote host
    DISABLE PARSE         Disables the expansion of file names
    DISABLE               Disables the sending of the FTP protocol
    PORT_COMMAND          PORT command
    DISABLE REPLY         Disables the display of all responses from
                          the remote host
    DISABLE               Disables the display of # for each 1K bytes
    TRANSFER_VERIFICATION of data transferred
    DISABLE               Disables the special OpenVMS-to-OpenVMS
    VMS_PLUS              transfer mode
    ENABLE LOG            Enables the display of all protocol
                          commands sent to the remote host
    ENABLE PARSE          Enables the expansion of file names
    ENABLE                Enables the sending of the FTP protocol
    PORT_COMMAND          PORT command
    ENABLE REPLY          Enables the display of all responses from
                          the remote host
    ENABLE                Enables the display of # for each 1K bytes
    TRANSFER_             of data transferred
    VERIFICATION
    ENABLE                Enables the special OpenVMS-to-OpenVMS
    VMS_PLUS              transfer mode
    HELP                  Invokes help
    QUOTE                 Sends FTP commands to the remote host
                          without local interpretation
    SET TYPE              Defines the data representation for file
                          transfers
    SHOW STATUS           Displays the current FTP parameter settings
                          and, if you have an open connect, the name
                          of the connected host
    SPAWN                 Spawns a subprocess at the DCL prompt

  2 - FTP Conventions

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

    o  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

    o  Quotation marks

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

       o  UNIX path names

       o  UNIX file names with slashes

       o  Lowercase or mixed-case host names, user names, passwords,
          file names, and command lines

       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>

    o  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:

       o  The percent sign (%) to represent an individual character

       o  The question mark (?) to represent an individual character

       o  The asterisk (*) to represent multiple characters

       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.

    o  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.

  3 - Starting FTP

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

    o  At the DCL prompt, enter the FTP command and specify a remote
       host.

    o  At the DCL prompt, enter the FTP command with no parameters.
       At the FTP prompt, enter the CONNECT or open command,
       specifying a remote host.

    o  By using the /FTP qualifier on the DCL COPY and DIRECTORY
       commands.

    o  Invoke and use FTP from a command procedure

    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.

    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:

    o  On the FTP command line, enter the /USERNAME qualifier.

    o  At the user name prompt, type your remote user name, for
       example:

       $ FTP SITE1

       220 site1.midwest.billing.bench.com FTP server (Version 5.0) ready
       Connected to SITE1.midwest.billing.bench.com.
       Name (SITE1:antel): crowe <return>
       331 Username CROWE requires a Password
       Password:         <Return> password not echoed
       230 User logged in

    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.

 3.1 - Examples

    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>

  4 - 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:

    o  A registered user account on the remote host

    o  To use your own user account, if you have one

    o  To supply a password

    With Anonymous FTP, you can:

    o  View remote directories

       -  View the guest and public directories with the FTP
          DIRECTORY command.

       -  The public directory called GUEST$PUBLIC has general
          bulletin-board information. It contains files of interest
          to FTP users.

    o  Copy files

       -  Enter GET and PUT commands to copy files to and from
          GUEST$PUBLIC.

       -  The public area is read-only. You can enter the GET command
          to copy files from the remote host to your local system.

       Optionally, there is an ANONYMOUS$USER directory where you
       can:

       -  Delete files

       -  Create directories

       -  Delete directories

       -  Rename files

       -  Rename directories

       The system manager sets up the access restrictions for
       Anonymous FTP. How the manager does this determines the
       availability of features.

 4.1 - Examples

    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>

  5 - 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.

 5.1 - Examples

    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>

  6 - Viewing Remote Directories

    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

  7 - 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.

  8 - 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;*

  9 - 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. 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.

    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 version numbers become the last element of the copied
       files.

    -  Semicolons are converted to periods.

 9.1 - 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.

 9.2 - Preserving 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:

    o  Specifying SET TYPE ASCII results in a sequential file with
       variable records. Select this type when transferring ASCII
       text files.

    o  Specifying SET TYPE IMAGE results in a sequential file with
       fixed records of 512 bytes. Select this type when transferring
       non-ASCII files such as binary files or executable image
       files.

    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

 9. 2.1 - Examples

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

       o  Creates the FDL file cygnet.bckfdl on the remote host with
          the RMS attributes of file STAT.BCK.

       o  Transfers the data in STAT.BCK and puts it in to
          cygnet.bckfdl on the remote host.

          FTP> PUT/FDL STAT.BCK CYGNET.BCK
          200 TYPE set to ASCII
          200 PORT command successful
          150 Opening data connection for cygnet.bckfdl (130.180.4.8,1028)
          226 Transfer complete
          local: cygnet.bckfdl   remote: cygnet.bckfdl
          846 bytes sent in 00:00:00.03 seconds
          200 TYPE set to IMAGE
          200 PORT command successful
          150 Opening data connection for cygnet.bck (130.180.4.8,1029)
          226 Transfer complete
          local: STAT.BCK  remote: cygnet.bck
          8152 bytes sent in 00:00:00.12 seconds
          FTP>
 In this final example, the GET/FDL command does the following:

       o  Transfers the FDL file cygnet.bckfdl from the remote host
          to the local host.

       o  Uses this file to re-create the file STAT.BCK, with all of
          its original RMS attributes, on the local host.

       o  Transfers the data in cygnet.bck and puts it in to the new
          local file STAT.BCK.

          FTP> GET/FDL CYGNET.BCK STAT.BCK
          200 TYPE set to ASCII
          200 PORT command successful
          150 Opening data connection for cygnet.bckfdl (130.180.4.8,1028)
          226 Transfer complete
          local: cygnet.bckfdl   remote: cygnet.bckfdl
          846 bytes sent in 00:00:00.03 seconds
          200 TYPE set to IMAGE
          200 PORT command successful
          150 Opening data connection for cygnet.bck (130.180.4.8,1029)
          226 Transfer complete
          local: STAT.BCK  remote: cygnet.bck
          8152 bytes sent in 00:00:00.12 seconds
          FTP>

 9.3 - Transfer Mode

    DIGITAL TCP/IP Services for OpenVMS supports only STREAM mode
    for data transfer. STREAM mode transmits the data as a stream of
    bytes.

 9.4 - File Structure

    DIGITAL TCP/IP Services for OpenVMS supports transfers of ASCII
    (stream, records with variable length) and IMAGE (binary, records
    fixed at 512 bytes) files. A file is a continuous sequence of
    data bytes.

  10 - Renaming and Deleting Files

    To change the name of a remote file, use the RENAME command.
    The following command renames file YEAR.DAT to YEAR96.DAT on the
    connected remote host:

    FTP> RENAME YEAR.DAT YEAR96.DAT

    To remove a remote file, use the DELETE command. The following
    command deletes all versions of file YEAR.DAT on the connected
    remote VMS host:

    FTP> DELETE YEAR.DAT;*

  11 - Viewing File Contents

    To display the contents of a file on a connected remote host, use
    the VIEW command and specify the file name. If the file is not in
    your current working directory, include the directory name in the
    file specification.

    The following example shows how to display the contents of file
    ENG.DIS located in the remote working directory:

    FTP> VIEW/PAGE ENG.DIS
    usrm::"khuna@jnet.com"
    pobox::bearse
    yield::timms
    usrm::"lerry@muster.cudenver.edu"
    sam
    nm%us1rmc::"ldutton@TopCom.com"

       .
       .
       .

  12 - Appending Files

    The FTP APPEND command allows you to concatenate a local file to
    a file on a connected remote host. The following command appends
    local file JUL_DEC.DAT to file YEAR.DAT on remote host KALI. (A
    connection has already been established to the remote host.)

    FTP> APPEND JUL_DEC.DAT YEAR.DAT
    200 PORT command successful
    150 Opening data connection for year.dat. (130.180.4.8,1108)
    226 Append transfer complete
    local:large.txt   remote:remote.dat
    15596 bytes sent in 00:00:00.10 seconds (152.30 Kbytes/s)

  13 - Customizing FTP

    You can modify the way FTP transfers files, depending on:

    o  The operating system of the remote host

    o  The applications you use

    o  Whether you want wildcard name expansion

    o  The information you want displayed during processing

    A few of the FTP commands that control FTP command processing
    are:

    o  ENABLE/DISABLE LOG

       Enables or disables the display of FTP commands sent to the
       remote host.

    o  ENABLE/DISABLE PARSE

       Enables or disables the expansion of file name specifications.

    o  ENABLE/DISABLE REPLY

       Enables or disables the display of all responses from the
       remote host.

    o  QUOTE

       Sends FTP commands directly to the remote host without local
       interpretation.

    The preceding commands control the way FTP displays command
    processing information and status. The SHOW STATUS command
    displays the current status of the FTP client (your local host)
    and, if you have a connection, the remote host.

    By default, FTP returns multiple lines of error messages
    (MULTILINE is enabled). The first line explains the general
    problem, while subsequent lines provide details to help you
    diagnose the source of the problem. These lines may include
    operating system as well as FTP messages. Applications that use
    FTP to transfer files under program control often do not need
    the extra messages returned. To disable the MULTILINE feature,
    when you supply a password to connect to a remote host, precede
    the password with a hyphen "-" (-password), as in the following
    example:

    $ FTP /USER=SALINGER /PASSWORD=-LETMEIN HAGELS

    The SHOW STATUS command displays whether the MULTILINE feature is
    enabled.

    You can modify the way FTP reacts to errors by using the SET
    ERROR_LEVEL command. By default, the error level setting is
    SUCCESS, which means that when FTP is running in batch mode, a
    warning or error message will cause FTP to exit. (FTP runs in
    batch mode when FTP commands are executed by a command procedure
    rather than interactively.) If you do not want FTP to exit upon a
    warning or error message, you can set the error level to ERROR.

    For example, in the following command procedure, if the default
    error level (SUCCESS) is in effect and directory [MILLER.USERS]
    does not exist, the resulting error would cause FTP to exit.

    $ FTP CONNECT HAGELS
    cd [MILLER.USERS]
    DEL *.*;*
    EXIT
    $

    If the error level had been set to ERROR, FTP would not exit
    and the DELETE command in the command procedure would delete all
    files in your current working directory. Note that you can also
    set the error level to WARNING, which causes FTP to tolerate
    warning messages (but not error messages).

  14 - Command Procedures

    You can use either OpenVMS or UNIX command syntax in DCL command
    procedures that use FTP. You can use command procedures to invoke
    FTP tasks, connecting to a remote host and performing assorted
    file operations with the remote host and you can use command
    procedures to customize the FTP environment.

 14.1 - Initialization Command Files

    Initialization command files can customize your FTP sessions
    with SET, ENABLE, and DISABLE commands. These command files
    are optional. They eliminate the need to enter individual FTP
    commands, and run automatically when you invoke FTP.

    Initialization command files:

    o  Contain only VMS commands

    o  Contain only one command per line

    o  Generally named SYS$LOGIN:FTPINIT.INI

 14.2 - Examples

 The following example shows an FTP initialization command procedure.
    ! This file, FTPINIT.INI, sets my FTP parameters
    ! the way I like them.
    !
    ENABLE REPLY
    ENABLE TRANSFER_VERIFICATION
    SET DEFAULT/LOCAL [MILLER.WORK]

    When you invoke FTP, the initialization file generates output
    such as the following, which displays environmental status:

    $ FTP
    Reply on.
    Verbose mode on.
    Bell off.
    Hash mark printing on (1024/hash mark).
    Local directory now SYS$LOGIN_DEVICE:[MILLER.WORK]

 14.3 - Setting Error Level

    To change the error level, you enter the following command where
    x is SUCCESS, WARNING, or ERROR:

    FTP> SET ERROR_LEVEL x

    o  If ERROR LEVEL is SUCCESS, then WARNING, ERROR, and FATAL will
       exit FTP.

    o  If ERROR LEVEL is WARNING, then ERROR and FATAL will exit FTP.

    o  If ERROR LEVEL is ERROR, then only FATAL will exit FTP.

    FATAL errors will always cause FTP to exit.

  15 - DECnet Operations

    To copy files from and to a DECnet node, use the standard GET and
    PUT commands

    You can copy files to and from DECnet nodes and get remote
    directory information, if your host and the DECnet node are
    connected through a host running DIGITAL TCP/IP Services for
    OpenVMS. Use the full file specification, including the node,
    device, directory, and file name.

 15.1 - Examples

    1. The following example copies local file FAX.TXT to DECnet node
       CURTAIL, renaming the file to CURRENT.TXT:

       FTP> PUT FAX.TXT CURTAIL::DISK$3:[GEARY.KEEPS]CURRENT.TXT

    2. The following GET command copies remote OpenVMS file
       HOUSING.TXT from DECnet node HABTAT and renames it to
       HOUSE.TXT:

       FTP> GET HABTAT::DISK$2:[NATL.UTAH.SWEST]HOUSING.TXT HOUSE.TXT
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.