qie.countFTPEndpointNoEncryption¶
Signature: qie.countFTPEndpointNoEncryption(host, port, path, binary, passive, ftpParameters, userName, password)
Returns: Integer fileCount - the count of files found
Returns the number of files found in the path specified.
Note
QIE uses version 4.22.0 of Apache Camel. (See this article for available parameters).
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | host | hostname or ip address for the ftp server | |
| Integer | port | the port number to use | |
| String | path | file path to count files | |
| Boolean | binary | transfer data using binary protocol | |
| Boolean | passive | use passive transfer mode (usually true) | |
| String | ftpParameters | additional custom camel ftp parameters to be used by this connection. (Format: {key}={value}\n{key2}={value2}...) | |
| String | userName | username to use for this connection | |
| String | password | password to use for this connection |
Example¶
// OPTIONAL SETUP:
// Create a file on the FTP server so there is something to count.
// Ignore errors if the file already exists.
try {
qie.writeFTPFileNoEncryption(
'sftp.example.com', // host: FTP server hostname
21, // port: FTP port (no encryption)
'theirs.txt', // path: remote file path
false, // binary: transfer mode
true, // passive: passive mode
'', // ftpParameters: additional Camel params
'interfaceUser', // userName: login username
'yourPassword', // password: login password
'More data to go in theirs.txt.' // data: content to write
);
} catch (error) {
qie.warn(error); // Expected if file already exists
}
// COUNT FILES:
// Count all .txt files on the FTP server using a wildcard path.
var countOfFiles = qie.countFTPEndpointNoEncryption(
'sftp.example.com', // host: FTP server hostname
21, // port: FTP port
'*.txt', // path: wildcard to match text files
false, // binary: transfer mode
true, // passive: passive mode
'', // ftpParameters: additional Camel params
'interfaceUser', // userName: login username
'yourPassword' // password: login password
);