check that path is a file and not a directory