aspose file tools*
The moose likes I/O and Streams and the fly likes Retrieve information of Folders and Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Retrieve information of Folders and Files" Watch "Retrieve information of Folders and Files" New topic
Author

Retrieve information of Folders and Files

Myat Thu
Greenhorn

Joined: Dec 10, 2008
Posts: 7
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.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

You should start by using code tags.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieve information of Folders and Files