qie.countSFTPEndpoint¶
Signature: qie.countSFTPEndpoint(host, port, path, binary, passive, ftpParameters, userName, password, sshKeyName*)
Returns: Integer fileCount - the count of files found
Returns the number of files found in the path specified.
Note
QIE uses version 4.23.0 of Apache Camel. See this KB 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 | |
| String | sshKeyName* | (optional) the name of the ssh key stored as a private certificate key |
Example¶
// OPTIONAL SETUP:
// Create a couple of files on the SFTP server so there is something to count.
// Ignore errors if the files already exist.
try {
qie.writeSFTPFile(
'sftp.example.com', // host: SFTP server hostname
22, // port: SFTP port
'mine.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
'Here is some data to go in mine.txt.' // file contents
);
} catch (error) {
qie.warn(error); // Expected if file already exists
}
try {
qie.writeSFTPFile(
'sftp.example.com', // host
22, // port
'theirs.txt', // path
false, // binary
true, // passive
'', // ftpParameters
'interfaceUser', // userName
'yourPassword', // password
'More data to go in theirs.txt.'
);
} catch (error) {
qie.warn(error);
}
// COUNT FILES:
// Count all files in the remote directory using a wildcard path.
var sftpServerFileCount = qie.countSFTPEndpoint(
'sftp.example.com', // host: SFTP server hostname
22, // port: SFTP port
'*', // path: wildcard to match all files
false, // binary: transfer mode
true, // passive: passive mode
'', // ftpParameters: additional Camel params
'interfaceUser', // userName: login username
'yourPassword' // password: login password
);