I have accidentally named a folder with an added space at the end on Linux. On Windows 10, this is not even possible, the space at the end is automatically deleted. On Linux Mint 19.2, this is possible, and it caused trouble when trying to access that folder back on Windows.

As soon as I copied an additional file into that folder, the folder was renamed by Windows to a foldername without a space at the end, with the result that TWO folders, one with the space at the end, one without and looking fully alike, were shown in Windows Explorer. BOTH folders had only the newly pasted file in it, with the rest of the files not shown.

First try to solve it:

After adding a suffix to the the folder with the space at the end and re-opening the Windows Explorer, I could also see the old files in the folder without a space at the end. I could also save these files somewhere else. Thus, the Linux files are just visually suppressed by the Windows Explorer folder manager, the newly pasted file and its assigned folder dominates everything that was in there before.

Problem2: I moved all files to a new folder without that problem. Then I tried to delete the folder that was corrected by Windows, but that did not exist! It was just visually pretended to be there. And I had to revert the renaming and the moving of the folder with the space ending in order to delete the folder without the space corrected by Windows.

Windows screenshots:

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here


Go back to Linux and remove the space ending, then go back to Windows and any file can be pasted as always.

But this solution is quite awkward.

It is especially if I somehow had even managed to delete the folder with the space ending on Windows (what I did not, but who knows how this might have happened else-wise?), since then, on Windows, I would not even have any chance to delete the corrected folder. I would have to create a new folder WITH a space on Linux in that same folder again only in order to be able to delete the folder WITHOUT a space. And then I would again have to go back to Linux as the solution says.

With or without deleting the folder on Windows, such confusion just because of space endings can happen to any user switching between Linux and Windows.

Thus the question:

On Linux, is there a setting that automatically removes the space(s) at the end of foldernames the same way as on Windows 10, meaning at the time of the change itself?

The problem was on an exfat SD-card, though I guess that it happens with NTFS as well. One could also see this not as a Linux, but as a pure Windows file management problem. That is why the Windows question as "the other side" is now on Super User with Windows 10: How to deal with foldernames ending with space(s) that are allowed on Linux but cannot be used any further in Windows Explorer?. Please answer here for the Linux solution, and there for the Windows solution.

  • Was the file on NTFS? you may have discovered a bug.
    – Jasen
    Commented Jan 2, 2021 at 21:53
  • @Jasen Files were saved on an SD card which I switch between my Linux Laptop and my Windows PC, file system type is named "fuse" in the properties of the card on Linux Mint. Gparted shows that File System is "exfat". Commented Jan 2, 2021 at 22:34
  • well, FAT doesn't do trailing spaces at all, but I don't know about EXFAT
    – Jasen
    Commented Jan 2, 2021 at 22:41

1 Answer 1


I see no evidence of such an option, either in the native driver or the FUSE one. Both drivers are relatively sparse on options.

From what I can tell, these are valid file names on an exFAT file system, and they're definitely valid on Linux. Since exFAT, like UDF, may be validly used on any operating system and Windows need not be involved at all, there's no reason to assume that these should be forbidden. Whether Windows supports them or not is a quality of implementation issue that doesn't exist on Linux (or macOS).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .