Libraries |
|
Ftp | Source Code |
|
|
Types | ||||
| ||||
|
ftpFileSys
const type: ftpFileSys
-
Extended FileSys interface type for FTP file systems. This interface type allows access to FTP specific methods: listDir, getActiveMode, setActiveMode, getAsciiTransfer, setAsciiTransfer. If this methods are not needed the interface type fileSys can be used instead.
ftpConnection
const type: ftpConnection
-
ftpFileSys implementation type for a connection to a FTP server. The file system methods trigger requests to the FTP server.
Function Summary | |||||
ftpFileSys |
| ||||
ftpFileSys |
| ||||
ftpFileSys |
| ||||
ftpFileSys |
| ||||
void |
| ||||
array string |
| ||||
array string |
| ||||
void |
| ||||
string |
| ||||
fileType |
| ||||
fileType |
| ||||
integer |
| ||||
bigInteger |
| ||||
time |
| ||||
boolean |
| ||||
void |
| ||||
boolean |
| ||||
void |
| ||||
file |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
string |
|
Function Detail |
openFtp
const func ftpFileSys: openFtp (in string: hostName, in string: user, in string: password, in integer: ftpControlPort)
-
Open a FTP file system at the specified host, user and port.
- Parameters:
- hostName - Either a host name ("e.g.: "www.example.org"), or an IPv4 address in standard dot notation (e.g.: "192.0.2.235"), or an IPv6 address in colon notation.
- user - Username to be used for the login.
- password - Password to be used for the login.
- ftpControlPort - Port to be used for the control connection. FTP usually uses the port 21, but other ports can also be specified.
- Returns:
- a file system that uses the FTP connection, or fileSys.value if the connection to the remote host could not be established.
openFtp
const func ftpFileSys: openFtp (in string: hostName, in string: user, in string: password)
-
Open a FTP file system at the specified host and user. This function uses port 21.
- Parameters:
- hostName - Either a host name ("e.g.: "www.example.org"), or an IPv4 address in standard dot notation (e.g.: "192.0.2.235"), or an IPv6 address in colon notation.
- user - Username to be used for the login.
- password - Password to be used for the login.
- Returns:
- a file system that uses the FTP connection, or fileSys.value if the connection to the remote host could not be established.
openFtp
const func ftpFileSys: openFtp (in string: connectStri, in integer: ftpControlPort)
-
Open a FTP file system with the specified connectStri and port. The connectStri should be in the form
user:password@hostName
to specify user and password. If no password is specified the password "anonymous" is used instead:
user@hostName
If no user and password are specified the user "anonymous" is used together with the password "anonymous":
hostName
The hostName is either a host name ("e.g.: "www.example.org"), or an IPv4 address in standard dot notation (e.g.: "192.0.2.235"). Operating systems supporting IPv6 may also accept an IPv6 address in colon notation.
- Parameters:
- connectStri - Connection string in one of the forms user:password@hostName user@hostName or hostName If no user is specified the user "anonymous" is used. If no password is specified the password "anonymous" is used.
- Returns:
- a file system that uses the FTP connection, or fileSys.value if the connection to the remote host could not be established.
openFtp
const func ftpFileSys: openFtp (in string: connectStri)
-
Open a FTP file system with the specified connectStri. The connectStri should be in the form
user:password@hostName
to specify user and password. If no password is specified the password "anonymous" is used instead:
user@hostName
If no user and password are specified the user "anonymous" is used together with the password "anonymous":
hostName
This function uses the port 21 (defined as defaultFtpControlPort). The hostName is either a host name ("e.g.: "www.example.org"), or an IPv4 address in standard dot notation (e.g.: "192.0.2.235"). Operating systems supporting IPv6 may also accept an IPv6 address in colon notation.
- Parameters:
- connectStri - Connection string in one of the forms user:password@hostName user@hostName or hostName If no user is specified the user "anomymous" is used. If no password is specified the password "anomymous" is used.
- Returns:
- a file system that uses the FTP connection, or fileSys.value if the connection to the remote host could not be established.
readDir
const func array string: readDir (inout ftpConnection: ftp, in string: dirPath)
-
Determine the filenames in a directory, using a FTP connection.
- Returns:
- an array with the file names.
- Raises:
- FILE_ERROR - The remote host returns an error.
listDir
const func array string: listDir (inout ftpConnection: ftp, in string: dirPath)
-
Get a directory listing, using a FTP connection.
- Returns:
- an array with the file names.
- Raises:
- FILE_ERROR - The remote host returns an error.
chdir
const proc: chdir (inout ftpConnection: ftp, in string: dirName)
-
Change the current working directory of a FTP connection.
- Raises:
- FILE_ERROR - The remote host returns an error.
getcwd
const func string: getcwd (inout ftpConnection: ftp)
-
Determine the current working directory of a FTP connection.
- Returns:
- the current working directory as absolute path.
- Raises:
- FILE_ERROR - The remote host returns an error.
fileType
const func fileType: fileType (inout ftpConnection: ftp, in string: fileName)
-
Determine the type of a file. The function does follow symbolic links. Therefore it never returns FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.
- Returns:
- the type of the file.
fileTypeSL
const func fileType: fileTypeSL (inout ftpConnection: ftp, in string: fileName)
-
Determine the type of a file. Since in FTP symbolic links are not defined this function is identical to fileType.
- Returns:
- the type of the file.
fileSize
const func integer: fileSize (inout ftpConnection: ftp, in string: fileName)
-
Determine the file size of a file. The file size is measured in bytes.
- Returns:
- the size of the file.
bigFileSize
const func bigInteger: bigFileSize (inout ftpConnection: ftp, in string: fileName)
-
Determine the file size of a file. The file size is measured in bytes.
- Returns:
- the size of the file.
getMTime
const func time: getMTime (inout ftpConnection: ftp, in string: fileName)
-
Determine the modification time of a file.
- Returns:
- the modification time of the file.
- Raises:
- RANGE_ERROR - the modification time is not representable in the type time.
getActiveMode
const func boolean: getActiveMode (in ftpConnection: ftp)
-
Get the data transfer mode.
- Returns:
- TRUE, if the transfer mode is active, or FALSE, if the transfer mode is passive.
setActiveMode
const proc: setActiveMode (inout ftpConnection: ftp, in boolean: activeMode)
-
Set the data transfer mode to active (=TRUE) or passive (=FALSE). By default passive mode is used.
getAsciiTransfer
const func boolean: getAsciiTransfer (in ftpConnection: ftp)
-
Get the file transfer type.
- Returns:
- TRUE, if the file transfer type is ASCII, or FALSE, if the file transfer type is BINARY.
setAsciiTransfer
const proc: setAsciiTransfer (inout ftpConnection: ftp, in boolean: asciiTransfer)
-
Set the file transfer type to ASCII (=TRUE) or BINARY (=FALSE). By default binary transfer is used.
open
const func file: open (inout ftpConnection: ftp, in string: filePath, in string: mode)
-
Open a file with filePath and mode using a FTP connection. There are text modes and binary modes:
- Binary modes:
- "r" Open file for reading.
- "w" Truncate to zero length or create file for writing.
- Text modes:
- "rt" Open file for reading.
- "wt" Truncate to zero length or create file for writing.
No other FTP functions can be used while reading and writing this file is going on. After this file has been closed other FTP functions can be used.
- Binary modes:
- Raises:
- RANGE_ERROR - The mode is not one of the allowed values or path does not use the standard path representation
getFile
const func string: getFile (inout ftpConnection: ftp, in string: filePath)
-
Get the contents of file filePath using a FTP connection.
- Returns:
- the specified file as string.
- Raises:
- FILE_ERROR - The remote host returns an error.
putFile
const proc: putFile (inout ftpConnection: ftp, in string: filePath, in string: stri)
-
Write stri to remote file filePath using a FTP connection. If the file exists already, it is overwritten.
- Raises:
- FILE_ERROR - The remote host returns an error.
removeFile
const proc: removeFile (inout ftpConnection: ftp, in string: fileName)
-
Remove a file using a FTP connection.
- Raises:
- FILE_ERROR - The remote host returns an error.
moveFile
const proc: moveFile (inout ftpConnection: ftp, in string: sourcePath, in string: destPath)
-
Rename a file using a FTP connection.
- Raises:
- FILE_ERROR - The remote host returns an error.
makeDir
const proc: makeDir (inout ftpConnection: ftp, in string: dirName)
-
Creates a directory on a remote host using a FTP connection.
- Raises:
- FILE_ERROR - The remote host returns an error.
rmdir
const proc: rmdir (inout ftpConnection: ftp, in string: dirName)
-
Deletes an empty directory using a FTP connection.
- Raises:
- FILE_ERROR - The remote host returns an error.
getFtp
const func string: getFtp (in string: location)
-
Get data specified by a location using the FTP protocol. The contents of the file "/Public/UNIDATA/UnicodeData.txt" can be obtained from the computer ftp.unicode.org with:
getFtp("ftp.unicode.org/Public/UNIDATA/UnicodeData.txt")
User and password can be specified with:
getFtp("user:password@www.example.org/pub/read_me.txt")
- Parameters:
- location - Url without ftp:// at the beginning.
- Returns:
- the string of data found, or "" if nothing was found.
|
|