Are file names like “foo .bar” (trailing space in base file name) unacceptable in Windows?

Question: Does Windows’ file naming restriction against trailing spaces in file names also apply to base file name with an extension (foo .bar), in addition to the whole file name (foo.bar or foo )?

Usually extension is understood to be part of the file name, but I found this Dropbox knowledge base article that explicitly warned against trailing space in base file name, before dot separator and extension: https://help.dropbox.com/organize/file-names

☑ Don’t add a space at the end of a file or folder name

For example, don’t name a file or folder Panda .png.

What lend credence to this Dropbox article is there are indeed cases where base name is considered separately when it comes to naming restrictions in Windows. For example: (1) LPT1 etc. with any extension (LPT1.bar, LPT1.txt etc.) is always a reserved name. (2) 8.3 filenames, with which modern Windows NT still maintain backward compatibility, have separate length limits applying to base file name and extension.

I was ready to start using PowerShell to sanitize such names, and there are indeed people on SO looking to do exactly that: https://stackoverflow.com/questions/71981307/removing-trailing-and-ending-blank-spaces-in-folder-and-file-names-on-windows-in But what I’ve found below made me wonder if this is actually necessary.

And just to clarify: (1) There are many things that can be put into file name in one OS or using certain APIs, but that does not mean it should be done, or it wouldn’t cause headaches later on/on other platforms. I am asking if there are pitfalls I am not aware of. (2) I am not asking about spaces in file names in general (need to be escaped in console), only if there is additional risk associated with trailing space in base file name.

Sources that are ambiguous, yet seem to suggest it is acceptable:

  1. This Microsoft Learn documentation: https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/file-folder-name-whitespace-characters Out of many examples in it, foo .txt was never explicitly mentioned which seemed to me to implicitly condone its use.

  2. This Microsoft Learn documentation: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file While it ambiguously said Do not end a file or directory name with a space or a period. , it also points towards Although the underlying file system may support such names, the Windows shell and user interface does not. as the culprit. When attempting to rename a file in Windows File Explorer, it lets foo .bar pass while stopping other disallowed cases (LPT1.bar,foo*.bar, foo.bar,foo.bar ) mentioned in the documentation.

Sources that are ambiguous:

  1. https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names/31976060

  2. https://stackoverflow.com/questions/36488979/forbidden-file-dir-names-in-linux-darwin-and-windows-nt-oses