I'm not really sure whagt the eval(file) is doing, but I would load all the files you want to evaluate into an array such as"
var searchMask = "*.jpg"
var fileArray = yourFolderName.getFiles(searchMask)
Then create your loop to open each of the files. You can then check the file name to see if it has what you want:
for(var i=0;i<fileArray.length;i++){
if(putYourConditionHere){docRef = open(fileArray[i])}
}