Another question, since it seems asyncFTPListFiles isn't documented anywhere: Is there a way to recursively list directories? I can successfully list directories and files in the root level, and differentiate between them. I'm having a problem digging into each directory to list those files, too.
Basically I'm putting the directory names into an array, and the file names into another. Eventually I'm trying to populate a drop-down with file names in the format "directory/filename."
If the directory array length is more than 0, then I do another asyncFTPListFiles and repeat the process. The problem comes from the way I'm looping through all the directories. I'm using a for loop to go through the directory array and open a new FTP connection, using the name from the array as the directory to list.
if (dirList != 0){
for (var a = 0; a < dirList.length; a++){
var currDir = dirList[a];
ogscript.asyncFTPListFiles(FTPip, 21, FTPuser, FTPpass, currDir, outputResults1);
}
}
Since the code is asynchronous, I can't use a variable in a for loop to mark what second level-directory we're listing, since by the time the second directory has been listed, the for loop has gone through all the other folders.
for (var i = 0; i < files.length; i++) // files is the array returned by asyncFTPListFiles
{
constraintData.push(currDir + '/' + files[i].getName()); //Push the key/value pair
}
Any thoughts? Thanks again!
#DashBoard