IFTP |
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]"] |
user | The user name to login to the FTP site |
password | The password to login to the FTP site. |
server | The FTP server name. |
path | The default directory on the server for this session. |
port | Port number. |
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. |
/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...
/O | Specifies 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. |
/S | Allows you to send commands directly to an FTP server. The connection must have already been opened by a previous IFTP command. |
/SSL=n | Specifies whether TLS/SSL is enabled in IFTP. When 0 (the default) the class operates in plaintext mode. When 1, TLS/SSL is enabled. |
/V | Display the dialog with the FTP server while opening the connection. This can be useful for debugging connection problems. |