qie.listFTPEndpointNoEncryption¶
Signature: qie.listFTPEndpointNoEncryption(host, port, path, binary, passive, ftpParameters, userName, password)
Returns: String[] fileNames - the array of leaf file names found (not full paths)
Returns an array of leaf file names (not full paths) found in the path specified. To read a returned file with qie.readFTPFileNoEncryption(...), create a full path by joining the source folder with the file name.
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 list 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 list.
// 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
}
// LIST FILES:
// Retrieve all .txt file names from the FTP server using a wildcard path.
var filesFound = qie.listFTPEndpointNoEncryption(
'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
);
if (filesFound.length > 0) {
for (var i = 0; i < filesFound.length; i++) {
qie.debug("Found file: " + filesFound[i]);
}
} else {
qie.debug("No files found on the FTP server.");
}