Why does NTFS disallow the use of trailing periods in directory names? [closed]

NTFS does not disallow it, it's only the Win32 API that does. As Alex noted in a comment, if you use \\?\... to skip the usual parsing and give the raw path to the NT API, then you can create a directory with a trailing period.

(Why does this work? The article Win32 File Namespaces says: "For file I/O, the "\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.")

As for why the trailing period is stripped, there doesn't seem to be any official documentation, but it might have to do something with compatibility with old MS-DOS or Windows 3.11 programs. In the 8.3 filename world, an empty extension and no extension at all was the same thing – in both cases, the filename XYZ would have been stored as XYZ····· and the extension as ··· (dots representing null bytes), so there might have been programs that relied on this fact. When Windows 95 got long filename support, it started storing both the name and extension as a single string, causing xyz and xyz. to become different filenames. It probably had to strip the trailing period to avoid breaking such programs.