public static File [ ] filesInFolderMatchingStemRegex ( File file , final String stemRegex ) { if ( file == null ) { return new File [ 0 ] ; } if ( ! file . exists ( ) || ! file . isDirectory ( ) ) { return new File [ 0 ] ; } return file . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return name . matches ( stemRegex ) ; } } ) ; }
Return the set of files matching the stemRegex as found in directory . A stemRegex does not contain any slash characters or any folder separators .