-4

I have 'm' no. of folders with 'n' of sub-folders and 'p' no. of sub-sub-folders inside them, which contain 'i' no. of images in each. Now I want to count and print them in excel sheet (with respective folders name in column). Note that few 'n' sub-folders may not contain 'p' sub-sub-folders.

Could anyone please explain me briefly with a sample program?

aswini
  • 81
  • 1
  • 1
  • 4

1 Answers1

0

Best and simple approach would be using Apache commons-io API.

    File file = new File("d:\\scan");       
    Collection<File> files = FileUtils.listFiles(file, null, true);     
    for(File file2 : files){
        System.out.println(file2.getName());            
    } 

    System.out.println( file.length());
swapy
  • 1,616
  • 1
  • 15
  • 31