Obsidian created a directory I can't delete

Things I have tried

While working in Obsidian with a note with quite a long filename and renaming it, it seemed to happen that Obsidian created (supposedly due to some mistake of mine) a directory that I then (if I remember correctly) moved to trash from within Obsidian.

Problem now is that I have a directory in .trash, that can neither be synched by Hidrive nor deleted with the explorer or from the commandline:

PS C:\Users\xyz\HiDrive\Dokumente\Obsidian\Zettelkasten.trash> dir ko*
dir : Das Element C:\Users\xyz\HiDrive\Dokumente\Obsidian\Zettelkasten.trash\Konzentrations- konnte nicht
gefunden werden.
In Zeile:1 Zeichen:1

  • dir ko*
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\Stefa\...nzentrations-  :String) [Get-ChildItem], IOException
      + FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

What I’m trying to do

Any ideas how I can get rid of this directory (Windows 11)?

It looks like somehow a directory got created that ends with a period character, which is not allowed by NTFS. I’ve run into this same problem in another unrelated project and it was a challenge to delete it.

If I recall correctly, we were able to remove the folder using the PowerShell “Remove-Item” command using some arcane prefixes, as described here:

I hope this points you in the right direction. Good luck!

Thank you for your tip!

I managed to delete the file from ‘Freefilesync’, a tool that seems to deal with forbidden filenames differently.

The cause was a directory-name with trailing spaces, which is forbidden under Windows.

Just to please my curiosity (so not really important):
In the solution-tip it suggests this command:
del “\?\c:<path_to_file_that contains a trailing space.txt>”

I understand that I’d have to replace <path_to_file_that contains a trailing space.txt> with C:\Users\xyz\HiDrive\Dokumente\Obsidian\Zettelkasten.trash\Konzentrations-
(with the trailing spaces).

What I don’t get is the first part del "\?
What does \?\ do? I can’t find any help or explanation on that one.

Again: not important, just curious.