cdm/src/main/java/thredds/inventory/CollectionGlob.java
public static DirectoryStream newDirectoryStream(Path dir, String glob) throws IOException {
    FileSystem fs = dir.getFileSystem();
    final PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
    DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
        public boolean accept(Path entry)  {
            return matcher.matches(entry.getFileName());
        }
    };
    return fs.provider().newDirectoryStream(dir, filter);
  }
public static DirectoryStream newDirectoryStream(Path dir, String glob) throws IOException {
    FileSystem fs = dir.getFileSystem();
    final PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
    DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
        public boolean accept(Path entry)  {
            return matcher.matches(entry.getFileName());
        }
    };
    return fs.provider().newDirectoryStream(dir, filter);
  }
public static DirectoryStream newDirectoryStream ( Path dir , String glob ) throws IOException { FileSystem fs = dir . getFileSystem ( ) ; final PathMatcher matcher = fs . getPathMatcher ( "glob:" + glob ) ; DirectoryStream . Filter < Path > filter = new DirectoryStream . Filter < Path > ( ) { public boolean accept ( Path entry ) { return matcher . matches ( entry . getFileName ( ) ) ; } } ; return fs . provider ( ) . newDirectoryStream ( dir , filter ) ; }
from http://blog.eyallupu.com/2011/11/java-7-working-with-directories.html
from http : // blog . eyallupu . com / 2011 / 11 / java - 7 - working - with - directories . html