title: How to get files by using index of List files in groovy
body: <p>I got the List of all files by using but it give all files , I need specific files from list.</p>
  
  <pre><code>import groovy.io.FileType
  
  def list = []
  
  def dir = new File("path_to_parent_dir")
  dir.eachFileRecurse (FileType.FILES) { file -&gt;
    list &lt;&lt; file
  }
  
  list.each {
    println it.path
  }
  </code></pre>