System.out.println("TransferEdtftpj::list(), directory = '"+listDir+"'");
// Grab the contents of this directory
FTPFile[] contents = m_ftp.dirDetails(listDir);
for(int a=0;a<contents.length;a++){
FTPFile file = contents[a];
String name = file.getName();
System.out.println("ftp list: name = "+name);
// Ignores any string which is null, or contains a "." or ".." in it
if(name == null || name.endsWith(".")) continue;
// Chop off the first / so you can safely concatenate it to the directory
if(name.startsWith("/")) name = name.substring(1);
name = directory+name;
// Is it a directory or file? add it to the appropriate array
/*
* There is a logic error with regard to recursing I think where this should
* be decided in the RemoteDirectory layer, not here, the problem is that I think
* this code will result in a list of files being created, but not the respective
* directories which exist, now, you should not recurse into those if it's disabled
* but you should create the basic entries anyway, but I dont think that happens at the
* moment.
*
*/
if(file.isDir() == true && m_details.getRecurse() == true){
folders.add(name+"/");
}else{
files.add(name);
}
}