class PhotoController {
def index = {
def baseFolder = grailsAttributes.getApplicationContext().getResource("/").getFile().toString()
def imagesFolder = baseFolder + '/images/sps'
def imageList1 = new File(imagesFolder).list()
[imageList:imageList1]
}
}
The above is listing non-jpg files too. How can I avoid that?!
You can invoke the eachFileMatch method on the folder: