I'm thinking that what Salem said should be your clue.

Note that you are looking in 'path' (which is a global??), but then you are not prepending path to the file names that you are looking at, so...