public String [ ] getDirectoryContent ( String scannerBaseDir , String [ ] includes , String [ ] excludes , boolean followSymlinks , boolean globCaseSensitive , boolean scanDirectories ) { File file = new File ( scannerBaseDir ) ; String [ ] fileNames ; if ( file . exists ( ) && file . isDirectory ( ) ) { DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( scannerBaseDir ) ; scanner . setIncludes ( includes ) ; scanner . setExcludes ( excludes ) ; scanner . setFollowSymlinks ( followSymlinks ) ; scanner . setCaseSensitive ( globCaseSensitive ) ; scanner . scan ( ) ; if ( ! scanDirectories ) { fileNames = scanner . getIncludedFiles ( ) ; } else { fileNames = scanner . getIncludedDirectories ( ) ; } return fileNames ; } else { logger . debug ( "{} is not a folder" , scannerBaseDir ) ; return new String [ 0 ] ; } }
get the content of directory by includes excludes followSymlinks and globCaseSensitive the scanDirectories property define if the scanner will scan to find directories