private void listFiles ( File dir , List < File > results ) { File [ ] found = dir . listFiles ( ) ; if ( found != null ) { for ( File f : found ) { if ( f . isDirectory ( ) ) { //do nothing } else { results . add ( f ) ; } } } }
Lists files in the directory given and adds them to the result list passed in optionally adding subdirectories recursively .