FTP Commands

The following table lists and describes the available FTP commands.

FTP Command

Description

ABOR

The ABOR command aborts the previous FTP service command and any associated transfer of data.

Server replies:

  • 226 ABOR command successful.

APPE

The APPE command appends data to the end of a file on the remote host. If the file does not already exist, it is created.

Server replies:

  • 556 Permission denied.
  • 226 Transfer complete.

AUTH

The AUTH command establishes an SSL encrypted session. Only the SSL type is supported.

Server replies:

  • 431 Service is unavailable.
  • 234 AUTH TLS request accepted.

CDUP

The CDUP command changes the parent directory.

Server replies:

  • 250 CWD command successful.
  • 550 Invalid Access.

CWD

The CWD command changes the working directory. If the directory name is not specified, the root directory (/) is assumed.

Server replies:

  • 250 CWD command successful.
  • 550 Invalid Access.

DELE

The DELE command deletes the file specified by the provided path.

Server replies:

  • 250 Command okay.
  • 550 Not a valid file.
  • 550 User has insufficient rights.

EPRT

The EPRT command allows for the specification of an extended address for the data connection. The extended address must consist of the network protocol, as well as the network and transport addresses. The format of EPRT is:

EPRT |<net-prt>|<net-addr>|<tcp-port>|

Server replies:

  • 200 EPRT command successful.

EPSV

The EPSV command requests that a server listen on a data port and wait for a connection.

Server replies:

  • 229 Entering passive mode (<message>).

FEAT

The FEAT command displays the feature list.

Server replies:

  • 211 iWay extended features.

HELP

The HELP command displays the HELP information.

Server replies:

  • 214 HELP information.

LIST

The LIST command causes a list to be sent from the server. If the path name specifies a directory or other group of files, the server should transfer a list of files in the specified directory. If the path name specifies a file, then the server should send current information on the file. A null argument implies that the user is currently working in that directory or it is a default directory.

Server replies:

  • 226 Transfer complete.

MDTM

The MDTM command returns the date and time of when a file was modified.

Server replies:

  • 553 File not found.
  • 213 <timestamp>.

MFMT

The MFMT command resets the remote files timestamp.

Server replies:

  • 213 ModifyTime=<timestamp>;/filename.

MKD

The MKD command causes the directory specified in the path name to be created as a directory (if the path name is absolute) or as a subdirectory of the current working directory (if the path name is relative).

Server replies:

  • 257 Directory Created.
  • 550 Already exists.
  • 550 No permission.

NLST

The NLST command causes a directory listing to be sent from the server to the user site. The path name should specify a directory or other system-specific file group descriptor. A null argument implies the current directory. The server will return a stream of file names and no other information.

Server replies:

  • 550 Connection refused: connect.
  • 226 Closing data connection.

NOOP

The NOOP command means there is no operation.

Server replies:

  • 200 NOOP command successful.

PASS

The PASS command is a Telnet string argument field specifying the user password. This command must be immediately preceded by the USER command.

Server replies:

  • 530 Login incorrect.
  • 230 User <username> logged in.

PASV

The PASV command requests the server to listen on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command. The response to this command includes the host and port address this server is listening on.

Server replies:

  • 227 Entering passive mode.

PBSZ

The PBSZ command represents the protection buffer size.

Server replies:

  • 431 Service unavailable.
  • 200 Command ok.

PORT

The PORT command is HOST-PORT specification argument for the data port to be used in data connection. There are defaults for both the user and server data ports, and under normal circumstances this command and its reply are not needed. If this command is used, the argument is the concatenation of a 32-bit internet host address and a 16-bit TCP port address. This address information is broken into 8-bit fields and the value of each field is transmitted as a decimal number (in character string representation). The fields are separated by commas. An example of a port command is:

PORT h1,h2,h3,h4,p1,p2

Server replies:

  • 200 PORT command successful.
  • 500 command not understood.

PROT

The PROT command returns a data channel protection level. The supported level values are C and P. P protects the connection, while C clears the connection.

Server replies:

  • 200 Command PROT ok.

PWD

The PWD command displays the name of the current working directory.

Server replies:

  • 257 “<current directory>.”

QUIT

The QUIT command closes the connection.

Server replies:

  • 221 Goodbye.

REST

The RESET command is an argument field that represents a server marker at which a file transfer is to be restarted. This command does not cause the file transfer but rather skips over the file to the specified data checkpoint. This command must be immediately followed by the appropriate FTP service command, which resumes the file transfer.

Server replies:

  • 350 Restarting at <position>. Send STOR or RETR to initiate transfer.
  • 501 not a number.

RETR

The RETR command causes the server to transfer a copy of the file, specified in the path name, to the server at the other end of the data connection. The status and contents of the file at the server site are unaffected.

Server replies:

  • 550 I/O Error: Connection refused: connect.
  • 226 Transfer complete.

RMD

The RMD command causes the directory specified in the path name to be removed as a directory (if the path name is absolute) or as a subdirectory of the current working directory (if the path name is relative).

Server replies:

  • 550 No permission.
  • 550 Not a valid directory.
  • 250 Directory removed.

RNFR

The RNFR command specifies the old path name of the file which is to be renamed. This command must be immediately followed by a RNTO command specifying the new file path name.

Server replies:

  • 350 File exists, ready for destination name.

RNTO

The RNTO command specifies the new path name of the designated file immediately preceding the RNFR command. Together the two commands cause a file to be renamed.

Server replies:

  • 250 RNTO command successful.
  • 550 <filename>: cannot rename.

SITE

The SITE command handles server-specific commands. For more information, see The SITE Command.

SIZE

The SIZE command returns the size of the file in bytes.

Server replies:

  • 553 <filename>: cannot read.
  • 213 <size>

STOR

The STOR command causes the server to accept the data transferred through the data connection and to store the data as a file at the server site. If the file specified in the path name exists at the server site, then its contents are replaced by the data being transferred. A new file is created at the server site if the file specified in the path name does not already exist.

Server replies:

  • 553 <filename>: cannot write.
  • 226 Transfer complete.

STOU

The STOU command behaves like the STOR command except that the resultant file is created in the current directory under a name unique to that directory.

Server replies:

  • 553 <filename>: cannot write.
  • 226 Transfer complete.

SYST

The SYST command is used to find out the type of operating system on the server.

Server replies:

  • 215 UNIX Type: Server Version <version>.

TYPE

The TYPE command specifies the representation type. The allowed types are A and I.

Server replies:

  • 200 Type set to <value>.

USER

The USER command is a Telnet string argument field identifying the user. The user identification is required by the server to access the file system.

Server replies:

  • 230 Already logged-in.
  • 530 Invalid user name.

iWay Software