Directories ending with dots behave strangely on Windows

Recently I noticed a strange directory whose name is foo.. When double-clicking it to view its content, I found it to be identical to foo. I then deleted foo and tried to view foo. again, but Windows Explorer said it not found. If I attempt to delete foo., foo is gone instead. Refreshing Explorer, rebooting will not erase foo., and raw disk browser still shows it's there. Also RD foo.\ cannot remove foo., but foo as well.
I'm curious about this "trailing dot mechanics". Can anyone explain its strange behavior?


In windows, the . character is a separator for extensions. When you have a folder, by default, it has no extension. A folder ending with a period basically is the same, a folder with no extension.

Although they both show up, internally they are referred as the same. So deleting one will delete both, but explorer is not smart enough to understand that which is why you still see it. If you want a folder that ends with a ., add a space behind the dot. Do note, the space has to be ALT+255. That way, a folder has the extension space and as such it is different, while by appearance it will look the same.