DirListItem = {
 Name      // string, fully qualified path and file name (ex: "/docs/resume.docx")
 Type      // string "FILE" or "DIR"
 Size      // number (64-bit integer)
 TimeStamp // timestamp of the item, in JavaScript "Date()" compatible format
}


Every call to a ListDir method of any AFT client object will produce an array as a result; each element of such array is an object of DirListItem type.

Once a resulting array has been obtained, you can use the typical JavaScript ways to iterate over it, and check the various property of each one of its items.


Example 1 (one way to iterate over a directory list, using a for cycle):

{
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'someusername';
 scli.KeyFile = './my_id.rsa';
 if (scli.Connect()) {
  dirList = scli.ListDir('/docs');
  for (var i = 0; i < dirList.length; i++) {
   Log(dirList[i].Name);
  }
  scli.Close();
 }
 scli = null
}


Example 2 (a different way to iterate over a directory list, using forEach):

{
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'someusername';
 scli.KeyFile = './my_id.rsa';
 if (scli.Connect()) {
  dirList = scli.ListDir('/docs');
  dirList.forEach(myFunction);
  function myFunction(item, index, array) {
    Log(item.Name + ' [' + item.Size + ' bytes] [' + item.Type + ']');
  }
  scli.Close();
 }
 scli = null
}