Syntax summary
Data sources
The following is the command syntax of the FTP adapter commands used for data sources:
-URL [FTP:[//
]][ftp_user[:ftp_pass]@][ftp_host[:ftp_port]]
[/[/]][dir/[dir/...]] [filename][;type=xfer_type[+]]
[-ACCT account_id]
[-AUDIT[+][S] [full_path]]
[-CERT {label}]
[-CPL code_page_name]
[-CPR code_page_name]
[-FIREWALL FTP://[fw_user[:fw_pass]@][fw_host[:fw_port]]
/method]
[-GXS]
[-IGNORE error_code[:error_code...]]
[-IMPLICIT]
[-KS]
[-LS sort_type]
[-MKD ]
[-MOVE [file_name|directory_location]]
[-PASV]
[-PORT]
[-QTY number]
[-QUOTE command]
[-SITE command_text]
[-SPROTO {SSLv2|SSLv3|SSLv23|TLSv1}]
[-STR {WEAK|STRONG|ANY}]
[-SYS {WIN32|UNIX|UNKNOWN}]
[-T[E][+][S|V] [full_path]]
Data targets
The following is the command syntax of the FTP adapter commands used for data targets:
-URL [FTP:[//]][ftp_user[:ftp_pass]@][ftp_host[:ftp_port]]
[/[/]][dir/[dir/...]] [filename][;type=xfer_type[+]]
[-ACCT account_id]
[-AUDIT[+][S] [full_path]
[-CERT {label}]
[-CPL code_page_name]
[-CPR code_page_name]
[-FIREWALL FTP://[fw_user[:fw_pass]@][fw_host[:fw_port]]
/method]
[-GXS]
[-IGNORE error_code{:error_code...}]
[-IMPLICIT]
[-KS]
[-LS sort_type]
[-MKD ]
[-PASV]
[-PORT]
[-PQUOTE command]
[-QUOTE command]
[-SITE command_text]
[-SPROTO {SSLv2|SSLv3|SSLv23|TLSv1}]
[-STAGE [file_name]
[-STR {WEAK|STRONG|ANY}]
[-SYS {WIN32|UNIX|UNKNOWN}]
[-T[E][+][S|V] [full_path]]
Using FTP adapter commands
Use the adapter commands from the Map Designer or Integration Flow Designer as the data source of an input map card and as the data target for an output map card. You can also use the adapter on the command line or in a map rule using the functions >GET, PUT, or RUN.
The FTP adapter requires the -URL adapter command for the
and settings.See "FTP Commands" for more information on FTP adapter commands and their syntax. For general information about commands, see the Resource Adapters documentation.
Examples of using FTP adapter commands
To retrieve the mine.txt file, located on the host computer, with no port specified, under c:\forms with no username or password specified, enter the following command:
-URL FTP://host/c:/forms/mine.txt
The following command example would retrieve the entire contents of the forms directory because the file name is omitted from the host computer:
-URL FTP://host/c:/forms/
To retrieve the payments.txt file, located on the source FTP server, with no port specified, with a username and password specified, and then move the file from its original location on the source FTP server to your root directory for that FTP client and rename it paymentsbackup.txt, enter the following command:
-URL FTP://ftpuser:mypassword@sourceftpserver/payments.txt -MOVE /paymentsbackup.txt
To retrieve the invoices.txt file, located on the source FTP server in the billing subdirectory, no port specified, with a user name and password specified, make the new billingbackup subdirectory in a location that is absolute to the current location of the original file, and then move the file from its original location on the source FTP server to the new subdirectory on the source FTP server with its original file name, enter the following command:
-URL FTP://ftpuser:mypassword@sourceftpserver/billing/invoices.txt
-MOVE /billingbackup/ -MKD
URL syntax
The syntax for the rest of the URL varies depending on the scheme selected. URL schemes that involve the direct use of an IP-based protocol for a specified host on the Internet use the following common syntax for scheme-specific data:
//user:password@host:port/url_path
Some or all parts of
user:password@,
:password, :port, and
/url_path can be excluded. The scheme-specific data
starts with a double slash (//) to indicate that it complies with the common Internet
scheme syntax. The user:password component conforms to the
following rules:
user: An optional username. Some schemes allow the specification of a user name.
password: An optional password. When present, it follows the user name and is separated by a colon. The user name and password are followed by an at sign (@). Any :, @, or / characters must be encoded, within the user and password field. 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 be omitted. The cwdx and name parts are empty. The whole url_path 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 will be sequentially supplied as the argument to a CWD, change working directory, command.
- If the type code is "d," perform an 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.
The xfer_type argument has been extended beyond what the RFC supports, specifically the D1, D2, D3, and D4 sections. Also, host:port should be excluded. Although it is rarely useful to do so, the host defaults to localhost.
URL encoding
The URL does not need to be completely `URL-encoded'. As shown in the following table, you only need to use escape characters for tokens specifically used in an FTP URL. Any FTP URL that contains spaces must be enclosed in quotation marks; for example:
-URL "FTP://Home Machine/FTP Files"
Tokens | Escape characters |
---|---|
% (percent) | %25 |
@ (at) | %40 |
/ (forward slash) | %2F |
: (colon) | %3A |
; (semicolon) | %3B |
& (ampersand) | Escape is not needed; use it as is. |
# (pound) | Escape is not needed; use it as is. |
8-bit or control characters | Escape is not needed; use it as is. |