Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.4k views
in Java FTP by (120 points)
Hi,
I m useing edtFTPj and having the Issue while visiting remote folders.
Bascically I want to populate my windows explorer like tree control with the remote folders as

FTPFile[] objFiles = objFTPUpload.ReadDirectoryStructure(strDir,strRootPath );
if(objFiles !=null){
for(int i=0;i<objFiles.length;i++){
if(objFiles[i].isDir()==true){

String strFolderName =objFiles[i].getName(); /// statement returing the actual name of the remote folder (fine)
String strPath =objFiles[i].getPath(); /// this statement is returing Null as the remote path (Need Help)

System.out.println(strFolderName);
System.out.println(strPath ); // Null is going to Print why

-----------------------------------------------------------------------------------------
while the FTP method is

public FTPFile[] ReadDirectoryStructure2(String strdir,String strRoot){


FTPClient objftpClient = new FTPClient();
FTPMessageCollector listener = new FTPMessageCollector();
FTPFile[] arrFtpFiles = null;

try {

objftpClient.setRemoteHost("Server");
objftpClient.setMessageListener(listener);
objftpClient.connect();
objftpClient.login( "user", "Password" );

arrFtpFiles = objftpClient.dirDetails(strRoot+File.separator+strdir);

} catch (Exception excp) {
excp.printStackTrace();
System.out.println("Exception: " + excp);

}
return arrFtpFiles;
}
Please Help me in this regard.

Thanks In Advance

Usman

1 Answer

0 votes
by (162k points)
FTPFile doesn't contain the path normally.

Categories

...