Try using FSO instead of Dir to get a list of the files in the directory, then loop through that list.