title: How to walk a directory tree on the classpath looking resource files?
body: <p>I have a collection of resources on the classpath something along the lines:</p>
  
  <pre><code>com/example/foo
      r1.txt
      r2.txt
      r3.txt
      bar/
        b1.txt
        b2.txt
        baz/
         x.txt
         y.txt
  </code></pre>
  
  <p>I know that this package is on the class-path sitting in WEB-INF lib, what I want to able to traverse the class-path starting at com.example.foo looking for all the .txt files. Call a function with siganutre similar to the following. </p>
  
  <p>List files = findFiles("com/example/foo","*.txt"); </p>
  
  <p>I am using spring 3.1 so I am happy to use any methods that are part of spring.</p>
  
  <p><strong>UPDATE:</strong>
  Solution using Spring based @jschoen suggestion below:</p>
  
  <pre><code>PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
  Resource[] resources = resolver.getResources("classpath:com/example/foo/**/*.txt");
  </code></pre>
  
  <p>The spring matches using ant style patters thus the need for the double ** </p>