in reply to file check not working
So, how does the file check fail?
Have you printed "$path$key" to check that it contains what you think it should contain?