Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Linux, I can have a folder named temp..

If I try to do a mkdir temp. on a Windows machine, the trailing period is truncated.

If I try to sync a directory from Linux to Windows that has a trailing period, it will fail (found in seafile by a colleague).

Why is that?

share|improve this question

closed as not constructive by grawity, bwDraco, Brad Patton, davidgo, HackToHell Apr 20 '13 at 16:03

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

So are you asking why NTFS doesn't allow it, why Seafile doesn't handle it gracefully, or how to Sync a file from Linux to Windows that has a period on the end? We need clarification, as questions like "why is this like this?" are generally considered "Not Constructive" and will be closed. Please consider editing your question to make it more about a specific problem you're trying to solve. – Ƭᴇcʜιᴇ007 Apr 19 '13 at 19:20
Though this likely won't solve your problem, if you lead the path name with \\?\ you should be able to name the folder as you wish. You should be able to run something along the lines of "mkdir \\?\C:\temp." in cmd and have it make a folder called "temp." under C:\, but you won't be able to access it since "?" isn't a network location. That said, you might be able to try that with a real network place and have it work, but I'm unable to test that in my current environment. – Mono Apr 19 '13 at 19:26
NTFS does not disallow it, just the Win32 API does. As Alex noted, 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. – grawity Apr 19 '13 at 19:44
@Alex: By the way, the period is stripped locally – the Windows SMB server talks directly to the NT API and allows creation of any name. – grawity Apr 19 '13 at 20:21
How the hell is this question not constructive?! Today I learned that Windows allows NULL byte exploits in directory names in a way that the Windows utilities that utilize the Windows API are unable to handle. – hopeseekr Dec 5 '13 at 18:41
up vote 8 down vote accepted

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.

share|improve this answer
until this question is reopened, I'll accept this answer – warren Apr 22 '13 at 13:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.