in reply to Counting files in a folder

Perhaps it would be simpler to work with your array if it were a different structure: