Zettelkasten Forum

Spaces in File Names

Over the years of being a middlingly-talented web developer, I've learned a dislike of spaces in file names. I know they are valid in filenames, and are at least addressed in URLs/URIs, but they seem to add just a little fragility to what is otherwise pretty solid without spaces.

I'm about to embrace wholeheartedly the community's recommendation of a unique ID in the filename, followed by the plain English name. I see the automation benefits of having the (Markdown) h1 in the Zettel being the same as the file name, so that leans me towards accepting spaces. But one of my goals here is a pretty rigorous future proofing, portability, and stability.

Have you all given this some thought and decided that spaces in file names are just not a problem at all? If so, my set of files are still small enough that I can swap strategies.

Thank you for any advice you can give.


  • Apart from 1990's DOS, long filenames and spaces are pretty well supported by operating systems all over the world. So access is very robust.

    Anecdote: Non-ASCII characters generally cause more trouble. I copied photos with umlauts in them created in 2008--2010 and wanted to bulk rename the files on a modern computer. It did find the input file in the directory listing, but the umlaut was encoded so weird that it split the file name in 2 file names for the tool (and for the shell, for that matter).

    So I'm worried about special characters more than spaces in general. But if you're fine with dashes, there's no computational downside to using them. It's just a PITA to read :) You have to decide which compromise is worth it.

    It's not costly to try either approach: Mass converting spaces to dashes or the other way round isn't much trouble either. It's almost a 1:1 conversion where you don't lose information. (Unlike, say, trimming titles from file names, leaving only the IDs.) I write "almost" because once you convert The post-apocalyptic trauma to The-post-apocalyptic-trauma, there's no lossless way to get back; it'd become The post apocalyptic trauma. So you'd have to be clever about existing dashes, e.g. replace - with double dashes -- first, then space with single dash - or some such.

    Author at Zettelkasten.de • https://christiantietze.de/

  • edited January 2022

    Don't get so obsessed with filenames, as long as there's a unique ID the rest is irrelevant. I've changed the title of some zettels in my notes or the content slightly and the backlinks still work because I fix the unique ID. Example,

    The original AJ20220122a19-This-is-the-original-title.txt after some work becomes AJ20220122a19-My-final-title.txt. The unique ID AJ20220122a19- is fixed. As long as the content is still relevant you can change your titles without breaking your context links to- and from other zettel notes.

  • edited January 2022

    Is the point of the example of @Splattack to define the dash "–" as a metacharacter whose interpretation is that anything following the initial dash is to be ignored for Zettel identification? Or have I "underthought" this?

    GitHub. Erdős #2. CC BY-SA 4.0. Problems worthy of attack / prove their worth by hitting back. -- Piet Hein.

  • edited January 2022

    EDIT: @ZettelDistraction the point of my example was that as long as you have a unique ID the rest of the filename (the title) could change and have no adverse effects in any of your notes. Therefore, the title isn't something we should be obsessed with.

    In my case, my unique ID is AJ20220122a19- including the dash. After that comes the title. So if you want to uses spaces in your titles and suddenly decide you don't want them anymore you could change them or leave them because as long as the unique ID is fixed and not altered, none of your notes linking to that note will suffer. The clickable links could suffer but you can always copy the unique ID and search for that unique note effortlessly.

    Previous message

    Hi @ZettelDistraction , the dash - in my filenames is to avoid using spaces. Inside my notes, whenever I refer to a file or embed an image (I use iA Writer for my Zettelkasten) is easier for the machine and for the syntax to have filenames with no spaces.

    For example, in one of my notes I have something like this;

    This is the current stage of my project;
    ![The caption of the image of my project diagram](my-project-image.png)
    - The editable project is in a spreadsheet `20210101-my-project.xlsx`.

    This above will show something like this;

    Sorry for the confusion caused by my writing

  • @Splattack I'll try this in Zettlr. I'm not sure if it will use the identifier only as the link, but we'll see.

    GitHub. Erdős #2. CC BY-SA 4.0. Problems worthy of attack / prove their worth by hitting back. -- Piet Hein.

Sign In or Register to comment.