From: Adrien Reboisson on
Hi,

CreateDirectory("C:\Foo\ BAR ") creates the folder " BAR" in
"C:\Foo", instead of creating the directory " BAR " (notice the spaces
*before* and *after* "BAR").

Why ? Is it a documented feature ? Why are the spaces on the right
removed by Windows ? I suspect that could be a compatibility "feature",
but anyway that's not stated in the "Remarks" section in MSDN :
http://msdn.microsoft.com/en-us/library/aa363855(VS.85).aspx

I'm running Windows 7... Any hints appreciated ;)

Best regards,

A.R.
From: Keith Moore on
On 2/2/2010 9:44 AM, Adrien Reboisson wrote:
> Hi,
>
> CreateDirectory("C:\Foo\ BAR ") creates the folder " BAR" in
> "C:\Foo", instead of creating the directory " BAR " (notice the spaces
> *before* and *after* "BAR").
>
> Why ? Is it a documented feature ? Why are the spaces on the right
> removed by Windows ? I suspect that could be a compatibility "feature",
> but anyway that's not stated in the "Remarks" section in MSDN :
> http://msdn.microsoft.com/en-us/library/aa363855(VS.85).aspx
>
> I'm running Windows 7... Any hints appreciated ;)
>
> Best regards,
>
> A.R.


From http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx

"Do not end a file or directory name with a space or a period. Although
the underlying file system may support such names, the Windows shell and
user interface does not."

You *might* be able to use the "\\?\" prefix to create a file/directory
with trailing spaces, but given the above statement and given the
behavior of many applications (cmd.exe, explorer.exe, etc) it's probably
a really bad idea.
From: Adrien Reboisson on
Thank you. I was aware of a lot of file naming limitations, but not this
one.

Cheers,

A.R.