Both would return true on Unix systems – in Unix everything is a file, including directories. But to test if that name is taken, you should check both. There might be a regular file named ‘foo’, which would prevent you from creating a directory name ‘foo’.