0

As described at http://technet.microsoft.com/en-us/library/cc781134(v=ws.10).aspx, Each NTFS file has a long file name and a corresponding short file name. NTFS can create more than 300 000 files under a directory, and in such a case, the short file names will conflicts.

If you have a large number of files (300,000 or more) in a folder, and the files have long file names with the same initial characters, the time required to create the files increases. The increase occurs because NTFS bases the short file name on the first six characters of the long file name. In folders with more than 300,000 files, the short file names start to conflict after NTFS uses all of the 8.3 names that are similar to the long file names. Repeated conflicts between a generated short file name and existing short file names cause NTFS to regenerate the short file name from 6 to 8 times.

However, Microsoft doesn't answer the question:

How does NTFS handle the conflict of short file names?

Provided that under directory d:\tmp\, there are more than 300 000 files, therefore, there are at least two different files whose short file names are both THISIS~1.txt, and if I enter the command "type THISIS~1.txt" under d:\tmp, what will happen?

Mark
  • 3,609
  • 1
  • 22
  • 33
xmllmx
  • 39,765
  • 26
  • 162
  • 323
  • Most probably answer: if all possible short names for a given file are already taken, no short name is created for that file. Note that you can turn off short name creation altogether on a volume. This is often the best solution. – Harry Johnston Aug 26 '13 at 04:29
  • The quoted documentation implies that it searches for a name that hasn't been used yet, so you'll never get a duplicate. The search becomes more difficult as more names get used up. – Mark Ransom Aug 26 '13 at 19:05
  • Possible duplicate of [How does Windows determine/handle the DOS short name of any given file?](http://stackoverflow.com/questions/324041/how-does-windows-determine-handle-the-dos-short-name-of-any-given-file) – phuclv May 21 '17 at 16:14

2 Answers2

0

NTFS won't create two short names like that. The first will be THISIS~1.txt and the second will be THISIS~2.txt. For example, open a command prompt and from the root of C: drive type

C:\>dir prog* /x /ad<Enter>

On a Windows 7 64-bit system you will see output similar to this

03/28/2013  12:24 PM    <DIR>          PROGRA~1     Program Files
07/31/2013  11:09 AM    <DIR>          PROGRA~2     Program Files (x86)
12/10/2012  05:30 PM    <DIR>          PROGRA~3     ProgramData
fatman45
  • 68
  • 1
  • 9
  • You're exactly right. That behavior is described here: http://support.microsoft.com/kb/142982 There are a few pathological cases with netware and windows 98 that also have support pages. – dcaswell Aug 24 '13 at 08:06
0

Sorry, but you're wrong here. I do have the problem of NTFS trying to create a file (actually 2 files, with different extension) with a long name that's partially different from another, yet I do get quite often (not always) the message that the name might conflict with another. And it also applies to Win 10 now.

Addendum: my apologies. After further investigation and trial, it became clear that the problem is caused by the long names (don't know about the short names). Though how this is possible is beyond me.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 18 '22 at 07:56
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32234073) – Jeremy Caney Jul 19 '22 at 08:04