Using FTP and HTTP Servers

Status
Not open for further replies.

Osiris

Golden Master
Messages
36,817
Location
Kentucky
Using FTP and HTTP Servers


The command processor allows direct access to remote servers from internal commands such as COPY, DEL, DIR, MOVE, MD, RD, REN, and SELECT via several protocols:



FTP (basic FTP)

TFTP (Trivial FTP)

FTPS (SSL FTP)

HTTP (basic Web access)

HTTPS (SSL HTTP)



The basic filename syntax for anonymous connections is:



ftp://ftp.abc.com/...



4NT and TC will look for your FTP user names and passwords in the file FTP.CFG, which is kept in the 4NT or TC directory by default. You can specify another directory with the FTPCFG directive. You must add entries to the FTP.CFG file manually. The format for each line is:



url username password



For example:



ftp://jpsoft.com fred secret

ftp://microsoft.com anyone mypassword



We recommend you encrypt this file if you're using NTFS. If FTP.CFG doesn't exist the first time 4NT or TC looks for it, it will be created as an encrypted file (NTFS only). Note: If you are using FAT / VFAT, the file will not be encrypted and your user names and passwords will be unprotected in plain text.



Note: FTP, HTTPS, and SSL processing is provided through files ipworks6.dll and ipwssl6.dll included in the 4NT and TC distribution packages. Those files are installed by default in the command processor's directory.



• FTP support:



You can also specify a username and password:



ftp://[username:password@]ftp.abc.com/...



For example, to get a directory of the JP Software FTP site, you could use this command:



[c:\] Dir ftp://jpsoft.com/*



If you have FTP permission on server ftp.abc.com and a subdirectory of the root directory on that server is called mydir, you can display the files with this command (enter this on one line):



[c:\] dir ftp://username:password@ftp.abc.com/mydir/*



You can also use the internal IFTP command to start an FTP session with a server and then use a simplified syntax to manipulate files on the server.



The command processor normally connects to the FTP server on the default FTP port 21. If the FTP server you are connecting to uses a non-standard port, enter the port number (with a preceding colon) just after the server name, for example:



[c:\] dir ftp://username:password@ftp.abc.com:8765/mydir/*



To log on to a server which supports "anonymous" logins, enter the required user name (usually "anonymous") and password (usually your email address) using the syntax shown above, for example:



[c:\] dir ftp://anonymous:email@domain.com@jpsoft.com/



The command processor will distinguish between the @ in the email address and the @ before the server name in order to separate the parts of the URL properly.



If you use a partial file or path reference, such as



[c:\] dir ftp:myfile.txt



the command processor will attempt to build a fully qualified directory name in which to find the requested file or path, based on what the server reports as the current working directory. If an ftp file or path specification begins with a ~ (tilde, typically indicative of a path relative to the user's home directory), the command processor will instead pass the exact string directly to the remote server.



The command processor uses standard FTP commands to retrieve information about files and directories and manipulate those files and directories on FTP servers, and relies on the server's compliance with Internet FTP standards. If your server is not fully compliant, or does not operate in the manner that the command processor expects, the results may not be what you intend. For example, if the FTP server you are connecting to is case-sensitivet, you may have to use the stored case of file and directory names when you use FTP commands. 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.



Time-related operations (e.g. switches like COPY /C or /U) may not always work reliably on FTP and HTTP servers, due to differences in time zone and in the file time representations between your local system and the server. Be sure to experiment with the particular server in question before depending on commands which compare file times to yield the results you want.



Note: If you use a partial reference such as ftp:mydir outside the scope of an IFTP command, the command processor will attempt to re-establish the last connection, if any. That new connection may or may not be logged to the last used directory on that sever. We recommend you always use a full reference (including server name) unless you are specifically taking advantage of an active IFTP connection. You can determine if there is an active IFTP connection with the _iftp and _iftps variables.



Before you can use the built-in FTP support or the IFTP command, you must establish the necessary connection to the Internet. For example, if you use Windows Dial-Up Networking to connect to the Internet, you must start your dial up connection first. If you connect through a proxy server, you must use the Proxy initialization directive.



Non-standard FTP servers:



If you have a non-standard FTP server (not Linux, Unix, or Windows) that creates an unusual directory format, you can create an entry in your FTP.CFG file to allow the command processor to parse the FTP server output. The format is described in the FTP.CFG following the host name, username, and password. The format characters are:



I"text" Do a wildcard comparison of "text" and the directory line; if it matches, discard the entire line. (This is to allow you to skip header & footer lines that would otherwise return garbage.)



"text" Compare (and skip) a literal string (does NOT support wildcard searches)



<space> Skip whitespace (spaces, tabs)



! Skip non-whitespace



- Ignore a single character



F Filename. If the F is followed by a . (i.e., "F."), the extension is the next non-whitespace string. The extension will be appended (preceded by a '.') to the filename.



S Subdirectory flag. If the S is followed by a =, the next character is the character in a "raw" directory listing that denotes a directory. If you don't specify a =, 'D' is assumed.



T Month as a string (i.e., "Jan", "Feb", etc.)



U Unix-style year (2004) or time (18:30) in the same field.



Y Year



M Month



D Day



h Hour



m Minute



H a or p (for am/pm)



Z File size. If the Z is followed by a =, the number following that is the block size.



(Note that upper/lower case is significant for the format characters.)



For example, the FTP.CFG entry for JPSOFT.COM can be described as:



jpsoft.com,anonymous,JPUser@,S ! ! ! Z T D U F





• TFTP ("trivial FTP") support:



See the FTP section above for general notes and requirements.



TFTP is only available with COPY (and with MOVE when the source is a local file). The syntax is:



tftp://server[:port]/filename



For example:



copy update tftp://190.189.188.0/update



• HTTP ("basic Web") support:



See the FTP section above for general notes and requirements.



The HTTP syntax is:



http://[user:password@]server[:port]/filename



For example:



copy http://jpsoft.com/



• FTPS ("SSL FTP") support:



See the FTP section above for general notes and requirements.



The FTPS syntax is:



ftps://[user:password@]server[:port]/filename



For example:



copy ftps://jpsoft.com/4nt/4nt600.exe





• HTTPS ("SSL HTTP") support:



See the FTP section above for general syntax and requirements.



The HTTPS syntax is:



https://[user:password@]server/filename



For example:



copy https://jpsoft.com/xyz.htm
 
Status
Not open for further replies.
Back
Top Bottom