Connected: An Internet Encyclopedia
RFC 1738 - 3.2.2. FTP url-path

Top: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1738
Up: 3. Specific Schemes
Up: 3.2. FTP
Prev: 3.2.1. FTP Name and Password
Next: 3.2.3. FTP Typecode is Optional

### 3.2.2. FTP url-path

The url-path of a FTP URL has the following syntax:

            <cwd1>/<cwd2>/.../<cwdN>/<name>;type=<typecode>

Where <cwd1> through <cwdN> and <name> are (possibly encoded) strings and <typecode> is one of the characters "a", "i", or "d". The part ";type=<typecode>" may be omitted. The <cwdx> and <name> parts may be empty. The whole url-path may be omitted, including the "/" delimiting it from the prefix containing user, password, host, and port.

The url-path is interpreted as a series of FTP commands as follows:

Each of the <cwd> elements is to be supplied, sequentially, as the argument to a CWD (change working directory) command.

If the typecode is "d", perform a NLST (name list) command with <name> as the argument, and interpret the results as a file directory listing.

Otherwise, perform a TYPE command with <typecode> as the argument, and then access the file whose name is <name> (for example, using the RETR command.)

Within a name or CWD component, the characters "/" and ";" are reserved and must be encoded. The components are decoded prior to their use in the FTP protocol. In particular, if the appropriate FTP sequence to access a particular file requires supplying a string containing a "/" as an argument to a CWD or RETR command, it is necessary to encode each "/".

For example, the URL <URL:ftp://myname@host.dom/%2Fetc/motd> is interpreted by FTP-ing to "host.dom", logging in as "myname" (prompting for a password if it is asked for), and then executing "CWD /etc" and then "RETR motd". This has a different meaning from <URL:ftp://myname@host.dom/etc/motd> which would "CWD etc" and then "RETR motd"; the initial "CWD" might be executed relative to the default directory for "myname". On the other hand, <URL:ftp://myname@host.dom//etc/motd>, would "CWD " with a null argument, then "CWD etc", and then "RETR motd".

FTP URLs may also be used for other operations; for example, it is possible to update a file on a remote file server, or infer information about it from the directory listings. The mechanism for doing so is not spelled out here.

Next: 3.2.3. FTP Typecode is Optional

Connected: An Internet Encyclopedia
RFC 1738 - 3.2.2. FTP url-path