I am struggling with the following problem. Can somebody pls help me?.
I have a file name and have a folder File f1= new File("path of the folder");. The folder is a complicated folder structure i.e. contains various files and sub folders which contains further subfolders etc. I want to show the whole folder structure(like tree structure). But, the following code shows only the "WebContent" structure.Please find below the following code:
Expand|Select|Wrap|Line Numbers
- File f1 = new File("D:/eclipse/workspace/cms/WebContent");
- File[] contents = f1.listFiles();
- for (int j=0; j<contents.length; j++)
- {
- if(contents[j].isDirectory())
- {
- out.println("Directory : "+contents[j].getName()+"<br/>");
- }
- else
- {
- out.println("Files :"+contents[j].getName()+"<br/>");
- }
- }
If anybody knows the answer, please let me know....
Thanks in Advance,
V. Prasath