detect file or directory