0

I have a folder which contains various subfolders (as seen in the graphic below). I am only interested in getting the list of contents for all subfolders labeled 'calculation'

Visual Example:

File structure example

So I want to start my search from root, recursively checking each directory. How can I accomplish this is Java 6?

Moonie Asemani
  • 375
  • 1
  • 4
  • 13

1 Answers1

1
  File root = new File( path );
    File[] list = root.listFiles(); // you can also use listFileAndDirs()

    if (list == null) return;

    for ( File f : list ) {
        if ( f.isDirectory() ) {
        //check for the name of 'calculation' and traverse it recursive

for more info look at : Recursively list files in Java

Community
  • 1
  • 1
Pankaj Verma
  • 191
  • 10