Chapter 4 - Syntax Summary
URL Syntax
F T P A d a p t e r R e f e r e n c e G u i d e
3 2
an at sign (
@
)
. Within the user and password field, any
:
,
@
, or
/
characters must be encoded. See
URL Encoding
.
The
url_path
of an FTP URL has the following syntax:
cwd1/cwd2/.../cwdN/name;type= xfer_type
where
cwd1
through
cwdN
and
name
are (possibly encoded) strings and
xfer_type
is one of the characters
a
,
i
, or
d
. The part
;type=
xfer_type
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
cwd
element is to be sequentially supplied 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
xfer_type
as the argument and
then access the file named
name
(for example, using the
RETR
command).
Note
The
xfer_type
argument has been extended beyond what is supported by the
RFC, specifically the D1, D2, D3, and D4 sections. Also,
host:port
may be
excluded, although it is rarely useful to do so;
host
defaults to
localhost
.