Created
April 28, 2017 15:24
-
-
Save sagrawal31/c4090e7d3268affd053cc11fb24ae5ce to your computer and use it in GitHub Desktop.
A Groovy code to recuse every file (of specific type) in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.io.FileType | |
File fooDirectory = new File("/some-path-to-the-parent-directory") | |
// Recurse only *.html file (for example) | |
def reportNamePattern = ~/.*\.html/ | |
fooDirectory.eachFileMatch(FileType.FILES, reportNamePattern) { File myFile -> | |
// Use myFile as you want | |
println myFile.name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment