Author Topic: File commands and case sensitivity  (Read 52 times)

etippelt

  • Newbie
  • *
  • Posts: 42
File commands and case sensitivity
« on: November 20, 2018, 07:16:25 am »
Good day folks!
I am getting some unexpected results with a bit of code that I've been using since 1995, and I would like to check the case sensitivity of some file commands.

So for example, are FileExist and FileCompare case sensitive when it comes to the actual filename?  If you use FileExist to check for c:\windows\win.ini, will it report the file as found if the file is actually WIN.INI ?

I could not find anything in a past posting here, or in the documentation. Nor can I find an IntControl that says "ignore case".

Any advice welcome!

Thanks
EdT
Using Winbatch since 1995. Excellent tool, awesome support always.

td

  • Tech Support
  • *****
  • Posts: 2653
    • WinBatch
Re: File commands and case sensitivity
« Reply #1 on: November 20, 2018, 07:25:33 am »
Both FAT32 and NTFS, the two most common Windows file systems, are case insensitive.  This means that all WinBatch file functions do not consider case in file paths, names, and extensions.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


ChuckC

  • Full Member
  • ***
  • Posts: 165
Re: File commands and case sensitivity
« Reply #2 on: November 20, 2018, 10:44:53 am »
Both file systems are also case preservative.  Whatever case you create a directory or file with will be preserved, and any enumeration operation will return it in its original case.  However, all operations that involve opening a handle via the name or looking up a file based on its name are case insensitive.

td

  • Tech Support
  • *****
  • Posts: 2653
    • WinBatch
Re: File commands and case sensitivity
« Reply #3 on: November 21, 2018, 08:04:49 am »
Just to be clear, enumeration operations performed using file masks .e.g. wildcards do not consider text case when matching file paths and/or names to the partial specification of the mask.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates