check for directory instead of file