Hello All,
I want to write program which can retrieve information of Folders structures and Files.
Becaue i planted to make treeview folder and file structure.
I want folders information dynamically.
Here is my current coding, please take a look.
import java.io.IOException;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPListParseEngine;
public class FTPLocation {
public static void main(
String args[]){
try{
FTPClient client=new FTPClient();
client.connect("localhost");
client.login("rootadmin","rootadmin");
FTPListParseEngine engine= client.initiateListParsing("Uploaded");
while(engine.hasNext()){
FTPFile[] filess=engine.getNext(30);
int count = filess.length;
while(count != 0){
if(filess[count-1].getRawListing().toString().startsWith("d")){
System.out.println("Folder Name:"+filess[count-1].getName());
/*******************************************************************************************/
/** HERE I WANT TO MAKE LOOPING TO GET INNER FOLDER AND FILES
/*******************************************************************************************/
}else{
System.out.println("File Name:"+filess[count-1].getName());
}
count = count - 1;
}
}
}catch(IOException e){
e.printStackTrace();
}
}
}
Here is my console output.
File Name:temp.xml
File Name:Min A Twet - Myo Kyawt Myaing.m4a
Folder Name:Old
Folder Name:New
Folder Name:InventoryEjb
Please suggest me how should i do.