Purpose:Open or close an FTP / FTPS / SFTP session

 

Format:IFTP [/= /S command /C /EP /IPv6 /K="key" /N /O=n /Pn /PR="n" /Q /R /SSL=n /V /V=hostname] /Z[n]] ["ftp://[user[:password]@]server[/path][:port]"]

 

userThe user name to login to the FTP site
passwordThe password to login to the FTP site.
serverThe FTP server name.
pathThe default directory on the server for this session.
portPort number.

 

/C(lose)

/Q(uiet)

/EP (extended passive)

/R(econnect)

/IPv6

/S(end)

/K (SSH public key)

/SSL

/N(o paths)

/T(cp keep-alive)

/O(verwrite)

/V(erbose)

/P(assive)

/V=hostname

/PR="n" (port range)

/Zn (zlib)

 

Usage:

 

Most file processing commands and functions in TCC can access files on FTP servers in the same manner as files on local hard drives and a local network. Normally, each time you use the FTP feature of one of these commands or functions, it repeatedly starts an FTP session, performs an individual operation, and closes the FTP session, until the command or function is finished.

 

IFTP starts an FTP session which remains open until you close it or it is closed by the remote server. There are several advantages to using IFTP: the FTP connection remains open so commands execute more quickly, the syntax for accessing files on the server is shorter, and you can specify a default directory on the server for file operations.

 

For example, to open an FTP connection using IFTP:

 

iftp ftp://user:[email protected]/dir1

 

For an FTPS connection, use something like:

 

iftp ftps://user:[email protected]/dir1

 

This command tells IFTP to open an FTP/FTPS session with the server myserver.com, send user as the login username and password as the login password, and to establish the directory /dir1 as the default directory for this session. The user name and password are optional; if they are not used, IFTP will attempt to log in anonymously. Double quotes are required if there are spaces or special characters in the filename. If you specify a password of *, you will be prompted to enter the password (which will appear on the screen as asterisks).

 

Note that in the example above dir1 is a subdirectory of the FTP "root" directory -- the home directory for the named FTP user. In most server configurations this is not the same as the FTP server's physical root directory.

 

Note: If you enter IFTP with no parameters while a connection is active, the current server name and directory will be displayed.

 

If you enter IFTP with only the /Q or /V switch, you change the amount of information displayed without disturbing the existing connection (if any).

 

Once you have established an FTP session with IFTP, you can refer to files on the server by using ftp: (or ftps:) but leaving out the user name, password, and URL of the server. On most servers, file and path names which begin ftp: are relative to the default directory, if any, that you specified when you opened the IFTP session; file and path names which begin ftp:/ are relative to the root directory for the login name.

 

The difference can be seen in these four DIR commands, assuming the IFTP session started above:

 

1. dir "ftp:*.txt"

2. dir "ftp:dir2/*.txt"

3. dir "ftp:/*.txt"

4. dir "ftp:/dir2/*.txt"

 

The first command lists the .TXT files in the default session directory, dir1. The second command lists the .TXT files in /dir1/dir2 because it interprets the path dir2/*.txt to be relative to the default directory. The quotes could be omitted from example 1 because it contains no forward slash that could be mistaken as an option switch. The third and fourth commands above, because they include a / immediately following the ftp: designator, are relative to the root directory. Command 3 lists the .TXT files in the root directory and command 4 lists the files in the dir2 subdirectory of the root directory.

 

Note: If an ftp file or path specification begins with a ~ (tilde), TCC will not attempt to build a full directory name but will instead pass the entire string  to the remote server.

 

You can only have one IFTP connection open at a time within a TCC tab window. However, while you have an IFTP connection open, you can still use a complete FTP URL to perform an operation on a different server. For example, while the session above is open, you can use this command to display all files in the root directory of microsoft.com:

 

dir "ftp://ftp.microsoft.com/*"

 

An IFTP session remains open until you explicitly close it with this command:

 

iftp /c

 

Most FTP servers "time out" after a period of inactivity. TCC will attempt to detect if the connection has been closed by the server, and reconnect if you reference the IFTP session again. You should not assume that an IFTP connection will continue to function if you leave it open but unused for a significant period of time. You can determine if the connection is still active with the _iftp, _iftps, and _isftp variables.

 

IFTP and the other FTP features of TCC rely on the server's compliance with Internet FTP standards. If your server is not fully compliant, or does not operate in the manner that TCC expects, commands may not work as you intend. We urge you to test each server you use with nondestructive commands like DIR before you try to copy or delete files, create or remove directories, etc.

 

IFTP will try to preserve timestamps when transferring files. The MDTM command is used when downloading, and the MFTM command is used when uploading. If the FTP server does not support these commands, the current date/time will be used for the timestamp.

 

Before you can use IFTP, you must establish the necessary connection to the Internet.

 

If you don't enter any arguments, IFTP will display its command dialog.

 

See FTP Servers for additional information on formatting and usage of FTP and FTPS references.

 

Options:

 

/=Display the IFTP command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/CUse this switch, with no URL, to close an IFTP session (see the example above).

 

/EPUse Extended Passive mode. (Works with FTP and FTPS, but not SFTP.)

 

/IPv6[=0|1|2]By default, IFTP expects an IPv4 address for the local and remote host, and will create an IPv4 socket. The /IPv6 option tells IFTP to use IPv6 instead. (Works with FTP, FTPS, and SFTP connections.) When set to 0, IFTP will use IPv4 exclusively. When set to 1, IFTP will use IPv6 exclusively. To instruct IFTP to prefer IPv6 addresses, but use IPv4 if IPv6 is not supported on the system, this setting should be set to 2. If you don't specify /IPV6, IFTP will set this value to 0.  If you specify /IPV6 with no explicit value, IFTP will set the value to 1.

 

/K="..."The CA signed client public key used when authenticating (SSH only). When authenticating via public key authentication this setting may be set to the CA signed client's public key. This is useful when the server has been configured to trust client keys signed by a particular CA. For example:

 

/K="[email protected] AAAAB3NzaC1yc2EAAAADAQABAAAB..."

 

The algorithm such as [email protected] in the above string is used as part of the authentication process. To use a different algorithm simply change this value. For instance all of the following are acceptable with the same signed public key:

 

[email protected] AAAAB3NzaC1yc2EAAAADAQABAAAB...

[email protected] AAAAB3NzaC1yc2EAAAADAQABAAAB...

[email protected] AAAAB3NzaC1yc2EAAAADAQABAAAB...

 

/NPass both source and target names to the server "as is" without any attempt at expanding the paths. This option should be used with caution and only for "non standard" servers for which the default processing fails to build a suitable name.

 

/OSpecifies whether or not IFTP should overwrite downloaded files. If /O=1, an error will be thrown whenever the local file exists before a download operation.

 

/P/P0 disables passive mode; /P1 enables it.

 

/PR="n"When using active mode, IFTP uses any available port to listen to incoming connections from the server. You can override this behavior by setting /PR (PortRange) to a value containing the range of ports the class will be listening to. The range is provided as start-end, for instance: "1024-" stands for anything higher than 1024, "1024-2048" stands for ports between 1024 and 2048 inclusive, "4000-4010, 50000-50010" stands for ports between 4000 and 4010 or between 50000 and 50010. (Works with FTP and FTPS, but not SFTP.)

 

/QTurn off the display of the conversation with the FTP server.

 

/RAutomatically reconnect if the FTP server times out.

 

/SAllows you to send commands directly to an FTP server. The connection must have already been opened by a previous IFTP command.

 

/SSL=nSpecifies whether TLS/SSL is enabled in IFTP. When 0 (the default) the class operates in plaintext mode. When 1, TLS/SSL is enabled.

 

/T=n If this is set, the socket's keep-alive option is enabled, and TCP keep-alive packets will be sent periodically to maintain the connection. n is the inactivity time in seconds before a TCP keep-alive packet is sent.

 

/VDisplay the dialog with the FTP server while opening the connection. This can be useful for debugging connection problems.

 

/V=hostnameSends the HOST command to the server. The HOST command allows FTP processes to specify which virtual host to connect to for a server-FTP process that is handling requests for multiple virtual hosts on a single IP address. When this option is set, the HOST command is sent to the server prior to authenticating.

 

/ZnUse Zlib compression. You can optionally set the compression level (0-9; the default is 7). Zlib compression must be enabled on the server, and will only work with FTP and FTPS connections (not SFTP).