Create a folder name with a period at the beginning

May 11, 2016

A tech writing colleague, Stuart B, sent me this information to share on this blog. He wanted to create or rename a folder in Windows that started with a period (e.g. .foo). Now, I don’t know WHY he wanted to do this, but he did. He found that Windows Explorer won’t let you create or rename a folder if you put a period at the beginning of the name — you get an error that tells you to type a file name, which of course you already did!

It seems you can do this in DOS using the mkdir command (mkdir .foo), but that’s clunky.

However, there’s a trick to getting Windows Explorer to create or rename such a folder — you add a period before AND after the file name (e.g. .foo.). Windows then strips the trailing period, but leaves the beginning one alone. And no error message.

Stuart said this trick seems to work in all versions of Windows he tested (Windows 10 back to Vista).

Thanks for sharing, Stuart!



  1. I’d be a bit wary of forcing Windows to create a folder that it really doesn’t want to create, because other things may go wrong later with that folder and the files below it. For example, in the past, I’ve seen folders that can’t be backed up, or even worse, can be backed up, but can’t be recovered from backup because of problems with folder names. Or some applications may be unable to access files in that folder.

    So I’d really want to understand why a folder with this name was needed, and make sure the folder and its contents could be used for their intended purpose.

  2. Interesting. If you put a period in front of a folder in the Android system, it not only allows you to do it, but the folder then becomes a hidden folder.

  3. That’s a good general practice, Titch (try not to trick or force an OS into doing stuff it really doesn’t want to do). In this case though I think it’s quite safe. Windows actually allows several ways to create dot files, such as ‘save as’ from Notepad and the two methods described above.

    Why do it? For each project we have a subfolder for all of the files relating to a release. We also have a few ‘dot folders’ for files that don’t map neatly to a particular release, such as .marketing. I decided to house the local copy of my source file repository in a folder called .repository so it stays with the other version-independent folders.

    (Rhonda pointed out that an underscore would work just as well, but dot folders are what we already happened to have.)

    Windows itself has no problem with dot files. In fact it’s a design requirement that Windows supports the POSIX standard and so has to interoperate with UNIX/Linux systems, dot files and all.

    Tools that originated on UNIX often use the dot prefix for settings or metadata or hidden files. For example, we are just moving from Subversion to Git for software configuration management. With Git each user has a local copy of the repository and the gory internal details are tucked away in a folder called .git. (Subversion uses a .svn folder for roughly similar reasons.)

    This is what I suspect Windows Explorer is doing:
    – It’s just a bug or limitation in the Explorer code that validates file names.
    – Explorer appears to count back from the end of the file name till it finds a dot (period/full stop). It assumes everything after the dot is the file extension and everything before it is the base name. So it treats .foo as a file with the extension .foo and no base name.
    – For Explorer only (not Windows) this is a problem. Users can opt to hide known file extensions in Explorer, so in this case if you named a file .exe or .doc presumably nothing would be displayed.
    – When you name a file .foo. Explorer treats it as a file with base name .foo and no extension.

    I didn’t know that about Android, Gabriel, but it’s based on a Linux kernel so it doesn’t surprise me that it treats a dot file as hidden.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: