Page 1 of 1

Index Case Sensitive Attribute of NTFS folders

Posted: Thu May 30, 2019 9:50 am
by Filippo
Hello voidtools team,
I need to find all folders with Case Sensitive Attribute enabled.
Please see: How to Enable Case Sensitive File and Folder Names on Windows 10
The command to check if a folder is case sensitive is: fsutil.exe file queryCaseSensitiveInfo C:\folder

Do you think that retrieving this flag from NTFS file system would be easy/possible or not?

Thank you and best regards,
Filippo.

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Thu May 30, 2019 11:12 am
by therube
(I've got to ask, what is the use case for case sensitivity?)

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Thu May 30, 2019 1:00 pm
by void
Currently there's no option in Everything to do this.

I've added a Case Sensitive Dir column and case-sensitive-dir: search for the next major version of Everything.

Thanks for the suggestion.

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/nf-ntifs-ntqueryinformationfile
https://stackoverflow.com/questions/52206212/programmatically-check-windows-10s-case-sensitive-directory-attribute

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Thu May 30, 2019 1:29 pm
by NotNull
Assuming "the next version of Everything" means the next major version of Everything, that might take a while (before you ask: No, no indication of release date available).

I could write you a simple script that "walks through" all folders and logs the ones with CaseSensitive flag enabled.

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri May 31, 2019 9:01 am
by void
Assuming "the next version of Everything" means the next major version of Everything
Correct.

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Thu Jun 06, 2019 3:52 pm
by NotNull
therube wrote:
Thu May 30, 2019 11:12 am
(I've got to ask, what is the use case for case sensitivity?)
Linux subsystem ("Linux on Ubuntu on Windows" or whatever not-catchy name Microsoft came up with this time :))
Linux is case sensitive.



For extra confusion: the NTFS filesystem itself is case-sensitive too (on a deeper level), but Windows (shell) is case-insensitive (but case-retentive).


@Filippo:
NotNull wrote:
Thu May 30, 2019 1:29 pm
I could write you a simple script that "walks through" all folders and logs the ones with CaseSensitive flag enabled.
Not needed?

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri Jun 07, 2019 3:40 pm
by therube
Yeah... But what do you gain by, where do you gain something, in what way would one find a need for explicitly requiring case sensitivity?


They say fsutil will find them:

Code: Select all

fsutil.exe  file  queryCaseSensitiveInfo  C:\folder

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri Jun 07, 2019 4:21 pm
by NotNull
therube wrote:
Fri Jun 07, 2019 3:40 pm
Yeah... But what do you gain by, where do you gain something, in what way would one find a need for explicitly requiring case sensitivity?
You should ask the designers of Unix/Linux/.. that :)

(IIRC, the Linux subsystem activates the case sensitive flag automatically when needed)
They say fsutil will find them:

Code: Select all

fsutil.exe  file  queryCaseSensitiveInfo  C:\folder
I wrote a script for @filipo using exactly that, so I can confirm that that is correct
(but I guess he is no longer in a "sensitive mood" ;) )

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri Jun 07, 2019 6:04 pm
by therube
So Unix did it, for various reasons, including speed & size.
OK.
And it persists to this day. OK.

And in order for MS to (better) interact with a "Unix subsystem", it they needs to play along.
OK.

And (programing) languages may use it to differentiate various constructs being used.
OK.

And an end user may use it.
Say a lowercase name is intended to be a program, & an uppercase name is intended to be the data portion for said program.
So the program is named, "data", & the associated program data is named, "DATA".
Wonderful.
So you can look down a directory listing & see & understand that data belongs to DATA.
Wonderful (again).
But then you could (case insensitive) DaTa.prog belongs dAtA.dat.
And you can look down a directory listing & know that caseinsensitive(name.prog) belongs to caseinsensite(name.dat).
Or, we could have /prog/data & /data/data, knowing that programs are in /prog/ & data files are in /data/.
Wonderful (yet again).

Other then forcing something like that, for whatever easons, I've yet to come across a compelling reason for case sensitivity.

Similarly, ShowTx.exe, creates an .ini file, named (guess what) ShowTx.ini.
And I can look in a directory & see showtx.exe & showtx.ini & can assume that they go together.
But, the beta version of ShowTx.exe now also creates a new file, IgnoreSectionMarkers.ini.
So I write the guy & say:
No big deal, but...

As it is, I tend to keep smaller, generally stand-alone utilities, in a /BIN/ directory.
Helps that if there is an associated .ini, that its' name relates to the .exe.
In this case, IgnoreSectionMarkers.ini.

No big deal, but maybe if it were something like ShowTx_IgnoreSectionMarkers.ini,
or similar.
(He didn't like the idea, BTW, which is OK too.
Also note that I tend to create directories, capitalized. I think there is an unwritten rule that you must do that; probably in the K&R how to create an OS manual.)

Now, if he could only rely on case sensitivity, that would make things much better ;-).

So... use case?

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri Jun 07, 2019 6:09 pm
by therube
fsutil.exe file queryCaseSensitiveInfo C:\folder
I wonder how fsutil queries a query when the subject folder is potentially casesensitive?
fsutil.exe file queryCaseSensitiveInfo C:\folder
fsutil.exe file queryCaseSensitiveInfo C:\FOLDER
fsutil.exe file queryCaseSensitiveInfo C:\foldeR
fsutil.exe file queryCaseSensitiveInfo C:\Folder
and how about this:
fsutil.exe file queryCaseSensitiveInfo c:\folder
With 6 letters (in the name-part, alone), I could probably come with at least a few unique names ;-).

Re: Index Case Sensitive Attribute of NTFS folders

Posted: Fri Jun 07, 2019 8:27 pm
by NotNull
therube wrote:
Fri Jun 07, 2019 6:04 pm
Other then forcing something like that, for whatever easons, I've yet to come across a compelling reason for case sensitivity.
[..]
So... use case?
Never thought about it, but you made me think .. (you already mentioned some good valid points. btw) ...

My theory: Unix was developed very long ago, in a time where available memory was measured in bytes instead of the current GB.
Meaning that you had to make the command-line options as short as possible, like ls -l -i -s -a (or ls -lisa) (compare that with everything.exe -install-folder-context-menu ;))
Being case-insensitive gives you only half of the letters available (-A = -a), which would cause problems for - for example - ls.
Commandline options have nothing to do with the filesystem, but I guess the mechanism works similar there.

Processing power was expensive too, so the less calculations had to be done, the better.
Suppose you have to check for the existence of a file.
In a case-insensitive world, you have to
- convert the filename to uppercase
- enumerate directory entries
- convert those to uppercase
- compare
In a case-sensitive world, you could skip the 2 converion steps. Cheaper.

(End of theroy)


It is not absolutely necessary for an operating system to be case sensitive. Look at Windows or DOS.

Also note that I tend to create directories, capitalized. I think there is an unwritten rule that you must do that; probably in the K&R how to create an OS manual.)
Those are old-school DOS habits :) But it has a use-case: it was easier to distinguish folders from files.
These days any halfway decent filemanager does that (displaying folders in uppercase) for you automatically or shows folders in a different colour or different font.

I wonder how fsutil queries a query when the subject folder is potentially casesensitive?
Hahaha, brilliant!

It is even worse : You can make an existing folder c:\therube case sensitive, but you can't create a c:\TheRube folder with the idea to make that one case-sensitive too in the next step. The two just cannot coexist!