Im currently writing a spock test and need to add a wild card to a file path. the script should look into the subjects folder and into all the subfolders to find the advanced folder and look for exam.txt, however, i keep receiving an error saying FileNotFound.
I believe the code is correct as it can parse files fine but the wildcard bit throws the exception.
new File("School/Exams/Questions/Subjects/**/Advanced")
if(it.name.matches("questions.txt"){
print it
}
You can use FileNameFinder to get list of file names:
new FileNameFinder()
.getFileNames('School/Exams/Questions/Subjects/', '**/Advanced/questions.txt')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With