title: How do I use directory globbing in JDK7
body: <p>I have been trying to use the new globbing feature in JDK7, starting from <a href="http://docs.oracle.com/javase/tutorial/essential/io/find.html">the documentation and examples</a></p>
  
  <p>I can get globs such as <code>"glob:*.dat"</code> to work with the </p>
  
  <pre><code>Files.walkFileTree(startingDir, finder);
  </code></pre>
  
  <p>example but I have been unable to get the <code>"**"</code> syntax working. I would like to be able to create something like:</p>
  
  <pre><code>matcher = FileSystems.getDefault().getPathMatcher("glob:" + "foo/**/bar/*.dat");
  </code></pre>
  
  <p>and would be grateful for a simple example. I am using Windows 7.</p>
  
  <p>UPDATE:
  @Oleg and @JBNizet make it clear that the "/" syntax is OS-independent. Note that the <a href="http://openjdk.java.net/projects/nio/javadoc/java/nio/file/FileSystem.html#getPathMatcher%28java.lang.String%29">Javadocs</a> suggest that OS-dependent syntax is also possible (?required)</p>
  
  <p>STILL PROBLEMS:
  Have taken @Nizet and edited as follows:</p>
  
  <pre><code>@Test
  public void testStackoverflowGlobber() throws IOException {
      final PathMatcher matcher =
   FileSystems.getDefault().getPathMatcher("glob:*.cml");
          Files.walkFileTree(Paths.get("d:/petermr-workspace/jumbo-converters/jumbo-converters-cli/src/test/resources"), new SimpleFileVisitor&lt;Path&gt;() {
              @Override
              public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                  System.out.println("try&gt;&gt; "+file);
                  if (matcher.matches(file)) {
                      System.out.println("MATCHES&gt;&gt;"+file);
                  }
                  return FileVisitResult.CONTINUE;
              }
          @Override
          public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
              return FileVisitResult.CONTINUE;
          }
      });
  }
  </code></pre>
  
  <p>and this gives output such  as:</p>
  
  <pre><code>try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cdx\r19.cdx
  try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cdx\r19.cdxml
  try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cdx\r19.cml
  try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cdx\r19.ref.cdxml
  try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cdx\r19.ref.cml
  try&gt;&gt; d:\petermr-workspace\jumbo-converters\jumbo-converters-cli\src\test\resources\examples\cif\aa2004.cml
  </code></pre>
  
  <p>but no evidence of matching</p>