trying ryan's trick of enumerating all the files first