Unable the get SubFolder Direcotry in Java?:-

Unable the get SubFolder Direcotry in Java?:-

Unable the get SubFolder Direcotry in Java?:- try {

String st1 = "C:\TestFolder; // Main Folder URL File folder = new File(st1); File[] listOfFiles = folder.listFiles(); for (File listOfFile : listOfFiles) { if (listOfFile.isFile()) { } else if (listOfFile.isDirectory()) { } } File[] files = folder.listFiles(); for (File file : files) { if (file.isDirectory()) {

} String str2= file.getCanonicalPath();// Geeting only Folder Not SubFodler System.out.println("===>"+str2); } } catch (Exception e) {

e.printStackTrace(); }

}

}

TestFolder.// main Folder 1A. Folder1 >> Sub Folder 1 >> Sub Sub Folder 1.

1B. Folder2 >> Sub Folder 2 >> Sub Sub Folder 2.

As of Now i am able to Access only Folder1 and Folder 2 form this Code . how can i access Sub Folder as Well Using Same Code . please help Needed as soon as .

View Answers









Related Tutorials/Questions & Answers:

Ads