The folder name was listed in File Explorer with just plain four dots .....

When I tried opening it, I came into some kind of endless rabbit hole loop where I opened the exact same folder again and again - I could do this endlessly. Showing the path like C:\ExamplePath\....\....\....\....\...., etc.

It was hanging my TypeScript compilation in one specific project. It took me more than a year before I found this folder and its related problems, because it was rooted deeply in nested folders. I never expected an issue like this, so I never looked for it.

I couldn't delete the folder the normal way because of the special name. In the end, I could remove it by using the command line and deleting the parent folder with rd /s /q path.

Afterward, I tried to create the folder again but was unable to do so with both File Explorer and the command line.

In my 20-plus years of using Windows I have never seen this bug before, so I can imagine that it would really be an annoying and confusing problem for amateur users.

Does anyone know how this could have happened and how to reproduce this issue?

Update

For people who are interested: this path was located deep within a TFS folder. So probably TFS uses the bypass method @grawity explained ("Various file managers, archivers, etc")

Did I stumble on a rare TFS bug?

migrated from serverfault.com Oct 31 at 8:26

This question came from our site for system and network administrators.

  • 5
    The answers below detail what's happening, how to reproduce it intentionally, and how to fix it, but they don't mention why it happened. Since .. can be used in a path to indicate 'go up one folder', I would hazard a guess that somewhere along the line, some program or script concatenated two strings to create a path, one ended with .., and the next began with .., and since it used one of the techniques mentioned below, it succeeded in creating the path, even though it was missing the folder separator between them. – 3D1T0R Oct 31 at 20:58
  • 5
    strange things will also happen if you create a folder with only spaces in its name – phuclv Nov 1 at 4:32
  • 6
    Is this server on the internet? Just to warn you I regularly see hack attempts on internet facing web servers requesting: GET /....\\....\\....\\....\\....\\....\\....\\....\\....\\winnt\\win.ini. Clearly there is/was some vulnerability somewhere that this attempts to exploit. – Andy Brown Nov 2 at 16:11
  • 4
    @AndyBrown much more likely that's .., not ..... It's simply a way to traverse to \winnt regardless of the depth of the starting point (the web root), so long as the starting point is less than 9 levels deep. It relies on the fact that going .. from the root directory leaves you at the root directory. – hobbs Nov 2 at 17:32
  • 5
    @hobbs That's a copy and paste from the Apache access log on linux. Definitely 4 dots in there. There are other hack attempts logged that do use .. which was why I found this one rather odd. – Andy Brown Nov 3 at 9:47
up vote 302 down vote accepted

Win32 doesn't let you create files or folders with names ending in . – all dots are stripped from the end. Trying to create test. makes test appear instead. (This is for compatibility with 8.3 names in old DOS/Win9x era software.)

As a result, whenever you try to access a folder named ...., its name gets reduced to the empty string, and you're back to the folder you were in before.

The NT kernel, however, does allow such names. There are various mechanisms which bypass filename limitations imposed by Win32 APIs – for example, WSL (Windows Subsystem for Linux) doesn't run on top of Win32 and is unaffected by it. There is also the \\?\ bypass method, a deliberate "backdoor" left in for programs which know what they're doing. Even though you cannot create C:\Example\....\, you can create \\?\C:\Example\....\ just fine.

Likewise you can delete such directories with rmdir \\?\C:\path\... from Cmd (I haven't tested with PowerShell yet).

Various file managers, archivers, etc. might use the \\?\ method in order to be able to use longer path names than usual – and by doing so, they're also unaffected by the compatibility code within Win32; they bypass dot stripping, as well as translation of magic filenames like CON or NUL.

So it could be that one of your programs:

  1. always uses \\?\ to access files,
  2. accidentally tried to create a folder named .... – but it's not really possible to know for sure after the fact.
  • 13
    another way to create such a folder is by using alternate data streams. On the cmd: echo "" > ....::$INDEX_ALLOCATION. This will create a folder named .... (still pointing to the current folder). – WorldSEnder Oct 31 at 12:53
  • 2
    @DirkBoer I found this: docs.microsoft.com/en-us/dotnet/standard/io/… – user31389 Oct 31 at 13:17
  • 124
    Microsoft calls this the "Extended Path Prefix", and paths with that prefix are called "extended-length paths". (funny: when you search for \\?\" in the .NET reference source, it causes a runtime error on their server). – dlatikay Oct 31 at 13:29
  • 2
    @grawity So . . . how should I go about deleting this folder now? – Shadow503 Oct 31 at 13:56
  • 21
    I had a curious 'computer repair' client case where anytime the client made an account on any windows machine, it would work just fine but once he logged/rebooted it wouldn't let him into his account, instead making a temp account for the session. The local pc-repair shop was stumped (charged him still). Turns out his actual name is Con & he always used his name for his windows account.....on that day I learned there was more than just com1 as a magic filename – RozzA Nov 2 at 5:26

In addition to @grawity's answer, a Win32 program can also do this by calling "native" API directly. If I'm not mistaken, in the present case, that would be NtCreateDirectoryObject. Those calls are fairly well documented nowadays, especially their kernel counterpart (which you cannot call from a Win32 program), in this case, ZwCreateDirectoryObject .

Regarding the "endless depth", an easy way to achieve this is to use links. Create a directory, then inside it, create a junction to it (you can use mklink /j for instance), and you will end up with a very deep structure. Last time I did this was on Windows 2000, there was an end to the recursion though (you couldn't "dig infinitely"). Possibly on newer OS the limit is bigger or removed, also you could create let's say 10 directories each being a child of the previous one, and in the 10th one, create a link back to the first one.

  • 3
    That's very possibly evil genius material right there ... – Agi Hammerthief Nov 1 at 14:35
  • 1
    I have copied full directories similarly to this to artificially fill up the disc for testing being able to determine when it was close to a set limit. – mickeyf Nov 1 at 16:08
  • It's also possible to reproduce using cygwin's mkdir .... – lucidbrot Nov 2 at 11:20

There is an easier way to create the directory. From the command prompt type:

MD ....\

and hit enter, it will create a directory with four dots. This directory is also viewable with explorer.

There is a flaw in MS-DOS that goes way back to version 1.0. MS has known about it for some time but could not or would not fix it. They have corrected the problem with PowerShell.

BTW, if you try:

RD ....

It will fail to delete. You need to use this specific syntax to remove it.

RD ....\

I use this on certain servers that I admin. I often create a user folder on the root of the disk and I don't want another administrator to come along and remove it.

So I will go inside my folder and create a subfolder named CON, AUX, or LPT, etc...

If another Admin wants to remove my folder they need to know how to remove this subfolder first.

EDIT: I was thinking about this discussion this morning and I decided to take this one step further. I assume the mods will decide if this is relevant.

I am unable to CD in to the folder.

Consider, if I MD c:\test then CD C:\test and MD ....\ I end up with C:\test....

and all is well.

But CD .... fails and kicks me back to C:\test. (CD ....\ does the same.)

However I can DIR .... and get a dir listing. I can also

MD C:\test....\temp and it creates that sub-dir in ....

I can also CD C:\test....\temp and go into that sub-sub directory.

But while in C:\test....\temp , if I CD .. I am back in C:\test.

I cannot cd into that directory, but I can manipulate the folder by creating subfolders, and interesting enough something like

ECHO "Testing" >> C:\test....\test.txt

also works and creates a file in that folder. So I can create a folder with four dots, I can add files and folders to it, I can get dir listings of it, but I cannot CD into it. Could there be some kind of evil genius use for this? My apologies to the mods if I have strayed too far off course.

  • 6
    That rather sounds like a Win32 API flaw, given that the command prompt hasn't been "MS-DOS" anymore for about twenty years now. – grawity Nov 2 at 5:39
  • 2
    Interestingly, If I try to delete the directory in windows explorer, it crashes when I created it with your version. When I created it with cygwin, it simply fails and says so. – lucidbrot Nov 2 at 11:26
  • I have a DOS 3.3 and a DOS 6.0 machines and the commands work on them. When they switched to 32 bit the issue was still there. it works in the CMD window from win95 all the way up to today, including all server versions. Now that we're switching to Powershell It no longer works. I realized after I wrote that that it does create the directory but it doesn't provide the effect that the OP was seeing. If I try to CD into the directory with four dots it just kicks me back out. – Larryc Nov 2 at 21:33
  • On my Windows 7 machine MD ....` only creates ....\....` tree - there is only one step of recursion. – Tomáš Zato Nov 7 at 16:07
  • Curiously FAR manager doesn't see this as special in any way, and creates / renames / deletes / lists the contents of directories named "lots of dots" with no issues at all. – RomanSt Nov 11 at 11:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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