FTP -- File Transfert Protocol



Le protocole FTP permet d'envoyer, de recevoir ou de rapatrier des fichiers quelque soit leur taille et leur nature.
Il est cependant recommander de coder les fichiers autres qu'ASCII car ils peuvent être altéré au cours de leur voyage. On utilise pour ce faire les normes BinHex, UUencode...

FTP utilise par défaut le port 21

Liste des commandes bas niveau FTP

Notez que les commandes marquées avec un astérisque * ne sont pas implémentées dans la plupart des serveurs FTP.

Commandes courantes

Commandes moins répandues


ABOR
Syntaxe : ABOR
Aborts a file transfer currently in progress.
ACCT*
Syntaxe : ACCT account-info
This command is used to send account information on systems that require it. Typically sent after a PASS command.
ALLO
Syntaxe : ALLO size [R max-record-size]
Allocates sufficient storage space to receive a file. If the maximum size of a record also needs to be known, that is sent as a second numeric parameter following a space, the capital letter "R", and another space.
APPE
Syntaxe : APPE remote-filename
Append data to the end of a file on the remote host. If the file does not already exist, it is created. This command must be preceded by a PORT or PASV command so that the server knows where to receive data from.
CDUP
Syntaxe : CDUP
Makes the parent of the current directory be the current directory.
CWD
Syntaxe : CWD remote-directory
Makes the given directory be the current directory on the remote host.
DELE
Syntaxe : DELE remote-filename
Deletes the given file on the remote host.
HELP
Syntaxe : HELP [command]
If a command is given, returns help on that command; otherwise, returns general help for the FTP server (usually a list of supported commands).
LIST
Syntaxe : LIST [remote-filespec]
If remote-filespec refers to a file, sends information about that file. If remote-filespec refers to a directory, sends information about each file in that directory. remote-filespec defaults to the current directory. This command must be preceded by a PORT or PASV command.
MDTM
Syntaxe : MDTM remote-filename
Returns the last-modified time of the given file on the remote host in the format "YYYYMMDDhhmmss": YYYY is the four-digit year, MM is the month from 01 to 12, DD is the day of the month from 01 to 31, hh is the hour from 00 to 23, mm is the minute from 00 to 59, and ss is the second from 00 to 59.
MKD
Syntaxe : MKD remote-directory
Creates the named directory on the remote host.
MODE
Syntaxe : MODE mode-character
Sets the transfer mode to one of: The default mode is Stream.
NLST
Syntaxe : NLST [remote-directory]
Returns a list of filenames in the given directory (defaulting to the current directory), with no other information. Must be preceded by a PORT or PASV command.
NOOP
Syntaxe : NOOP
Does nothing except return a response.
PASS
Syntaxe : PASS password
After sending the USER command, send this command to complete the login process. (Note, however, that an ACCT command may have to be used on some systems.)
PASV
Syntaxe : PASV
Tells the server to enter "passive mode". In passive mode, the server will wait for the client to establish a connection with it rather than attempting to connect to a client-specified port. The server will respond with the address of the port it is listening on, with a message like:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number.
PORT
Syntaxe : PORT a1,a2,a3,a4,p1,p2
Specifies the host and port to which the server should connect for the next file transfer. This is interpreted as IP address a1.a2.a3.a4, port p1*256+p2.
PWD
Syntaxe : PWD
Returns the name of the current directory on the remote host.
QUIT
Syntaxe : QUIT
Terminates the command connection.
REIN*
Syntaxe : REIN
Reinitializes the command connection - cancels the current user/password/account information. Should be followed by a USER command for another login.
REST
Syntaxe : REST position
Sets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR only); i.e. it must come after any PORT or PASV command.
RETR
Syntaxe : RETR remote-filename
Begins transmission of a file from the remote host. Must be preceded by either a PORT command or a PASV command to indicate where the server should send data.
RMD
Syntaxe : RMD remote-directory
Deletes the named directory on the remote host.
RNFR
Syntaxe : RNFR from-filename
Used when renaming a file. Use this command to specify the file to be renamed; follow it with an RNTO command to specify the new name for the file.
RNTO
Syntaxe : RNTO to-filename
Used when renaming a file. After sending an RNFR command to specify the file to rename, send this command to specify the new name for the file.
SITE*
Syntaxe : SITE site-specific-command
Executes a site-specific command.
SIZE
Syntaxe : SIZE remote-filename
Returns the size of the remote file as a decimal number.
STAT
Syntaxe : STAT [remote-filespec]
If invoked without parameters, returns general status information about the FTP server process. If a parameter is given, acts like the LIST command, except that data is sent over the control connection (no PORT or PASV command is required).
STOR
Syntaxe : STOR remote-filename
Begins transmission of a file to the remote site. Must be preceded by either a PORT command or a PASV command so the server knows where to accept data from.
STOU
Syntaxe : STOU
Begins transmission of a file to the remote site; the remote filename will be unique in the current directory. The response from the server will include the filename.
STRU
Syntaxe : STRU structure-character
Sets the file structure for transfer to one of: The default structure is File.
SYST
Syntaxe : SYST
Returns a word identifying the system, the word "Type:", and the default transfer type (as would be set by the TYPE command). For example: UNIX Type: L8
TYPE
Syntaxe : TYPE type-character [second-type-character]
Sets the type of file to be transferred. type-character can be any of: For A and E, the second-type-character specifies how the text should be interpreted. It can be: For L, the second-type-character specifies the number of bits per byte on the local system, and may not be omitted.
USER
Syntaxe : USER username
Send this command to begin the login process. username should be a valid username on the system, or "anonymous" to initiate an anonymous login.

Documentation de référence

Documentation obsoletes

Logiciels

Linux

Client

ici

Serveur

Macintosh

Client

ici

Serveur

Windows

Client

ici

Serveur


Christophe Merlet
redfox@redfoxcenter.org
©Tous droits réservés
17 novembre 2005