Function also outputs list of only filenames