GetDir
Lists the contents of a directory from a remote environment.
| myFiles.GetDir(options: FileTransferOptions):Array<string>
|
Parameters
FileTransferOptions options
The transfer options.
Returns
An array of strings representing the file names in the directory.
Examples
Download every file in a directory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | var server = {
RemoteHost : 'ftp.example.com',
RemotePath : 'outgoing',
UserName : 'transfer',
Password : 'secret'
};
$Files.GetDir(server).forEach(function (name) {
var file = $Files.Download(name, 'application/octet-stream', {
RemoteHost : server.RemoteHost,
RemotePath : server.RemotePath + '/' + name,
UserName : server.UserName,
Password : server.Password
});
$Xml.AppendChild('Imports/Import', function (node) {
node.SetValue('File', file.Id);
});
});
|