Node: `fs.mkdir` is case-insensitive

Created on 30 Dec 2018  Â·  5Comments  Â·  Source: nodejs/node

  • Version: v11.6.0
  • Platform: 64-bit Windows (v10.0.17763.195)

I'm not sure if this is a feature or a bug, but, as the title suggests, the path argument for fs.mkdir and its synchronous counterpart is case-insensitive. Assuming that there exists a folder named foo in the current working directory, this code throws an error with code EEXISTS.

// This throws an error because a directory named `foo` already exists.
require('fs').mkdir('Foo', console.error);

This baffled me at first because directories are supposed to be case-sensitive, right? So yeah, I'm still not sure if this is a bug, but I'm putting it here just to be sure.

fs question windows

Most helpful comment

On Windows, file systems are case-insensitive, you cannot create such 2 dirs in a shell or Explorer as well:

>md foo
>md Foo
A subdirectory or file Foo already exists.

All 5 comments

On Windows, file systems are case-insensitive, you cannot create such 2 dirs in a shell or Explorer as well:

>md foo
>md Foo
A subdirectory or file Foo already exists.

Aww, man... That sucks. 😞 Is there any workaround for it at least?

If you really want to try, this link might help a bit: https://superuser.com/a/842670

I think this question has been answered as well as possible – if you have follow-up questions, can you open an issue at https://github.com/nodejs/help?

Okay, I see. Thanks for the help, guys! I appreciate it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danialkhansari picture danialkhansari  Â·  3Comments

vsemozhetbyt picture vsemozhetbyt  Â·  3Comments

filipesilvaa picture filipesilvaa  Â·  3Comments

loretoparisi picture loretoparisi  Â·  3Comments

seishun picture seishun  Â·  3Comments