~ / plaintextfiles.com / guides / naming-schemes.md

How to name your files

There are two groups of people when it comes to naming files: those who barely give it a thought and those who overthink it. For the most part, how we name our plain text files starts and ends with picking words that are representative of the content of those files.

The following are some file naming considerations that might help make organising and returning to your files easier in the long run. And an organised presentation of your most decent choices might help you not overthink things if that is something you are guilty of.

Try not to have spaces

You might argue that this habit is a bit of a holdover from the ’90s and before, but it sometimes pays to not have spaces in your file names. Make no mistake, modern OSes do not have a problem with spaces in file names. However, the downside of habit goes beyond the OS itself.

For starters, file URLs become ugly pretty quickly. Say you have a file called This is an example file.md compared with this_is_an_example_file.md. These would be their file URLs:

~/plaintextfiles.com/This%20is%20an%20example%20file.md
~/plaintextfiles.com/this_is_an_example_file.md

One of these is clearly ugly. And it gets worse if you ever, as most people who prefer plain text files do at some point, engage with even the simplest of scripts, the command line and other such contexts where you will have to take care that spaces are escaped properly, such as using the %20 in the example above.

There is no guarantee how other file systems to which you might carry over your plain text files will handle internal links you might have used or link to your flies themselves. But really, the fact that your file names remain readable in all contexts should be the only motivation you need to never have spaces in your file names.

If not spaces, then what?

So what do you use instead of spaces? Here too you have plenty of choices. You could simply have no spaces, in which case you can choose from among three possibilities:

The problem with the third one should be obvious: you cannot read it as quickly and, worse, you risk breaking up words in the wrong places e.g. expertsexchange so let us pretend it does not exist. The other two are perfectly usable unless you want to have more information contained in your file names.

But first, a few other possibilities for when you do not want to use spaces, but also want something to differentiate words more easily than uppercase letters:

There are variations on these which are much less useful for us (e.g. SCREAMING_SNAKE_CASE is the same as snake_case but in all capital letters) so let us keep them aside for now.

Either of these can prove to be excellent replacements for spaces, although plaintextfiles.com prefers the first two simply because they will still allow for some words to be capitalised as needed and capitalising the first letter of every word has little benefit.

Informative vs efficient file names

This one is entirely down to personal preferences, needs and organisational habits. It can sometimes help to keep file names efficient, picking the smallest possible word that is still unique. This is the approach this website uses just so that file names can be easy to recall and reproduce since they are also the URLs on this website.

Offline, however, it can be more useful to add some information to the file name. People engaging with zettelkasten, for instance, might find it useful to add a timestamp to the file name which also serves as a unique ID e.g. 251222100814-some_file_name.md while still others, including certain Emacs packages stuff the file name full of information. If you do plan to use date stamps, it is worth paying special consideration to date formats too.

Doing this can help discern useful information at a glance from file trees but it can also be useful to programmatically understand what a file contains, if you hope to build that sort of thing. Things can get as complex as ID--File_Category--File_Name.md if you like, or even more if you find that sort of thing pleasing. There is no right or wrong here.

Consider cursor movements

You may have noticed a pattern in how we named files in our examples already, but if not this section should explain the preferred scheme at plaintext.com. While both snake_case and kebab-case are equally great replacements for spaces, they themselves differ in one key aspect: cursor movements.

When you want to use and to move around your file names (alt + arrows on Windows), such as when renaming them or if you like to use a terminal-based editor or something like Emacs or Vim, using hyphens and underscores intelligently can help you move more efficiently.

Generally, keyboard movements treat underscores as part of a word while hyphens are treated equivalent to spaces between words. If you want to use a naming scheme like ID--File_Category--File_Name.md using hyphens to split up sections of the file name means you can jump from the ID to the category to the name in three clicks of your keyboard:

^ID^--^File_Category^--^File_Name^.^md^

In the line above we use ^ to denote the points to which your cursor will jump when you move them using and or alt + arrows. Compare this to using either underscores all through (useless) or hyphens everywhere (annoying).

^ID__File_Category__File_Name^.^md^
^ID^--^File^-^Category^--^File^-^Name^.^md^

All three approaches are readable, but using only underscores makes it hard to quickly jump to parts of your file name to change it. Using hyphens makes your cursor stop at every spot, which might not always be bad, but using a combination of hyphens and underscores can make it more dynamic and useful.

It can be tempting to think that none of these matter because you are unlikely to change file names ever, or you prefer to use a GUI-based programme to work anyway. But this is one of those cases where things can be unexpectedly useful and it only ever has to be useful once to make a massive difference in your workflow.

Two final notes: on this website we have little option but to use hyphens because file names are also URLs, and the .md extension used throughout this page and elsewhere on this website is simply a stand-in for any plain text file extension like .txt or .org and does not matter for choosing the file name itself.

---