make rmdir check if target is a directory