Usable file names Fri, 25 Mar 2022 20:00:00 -0400 I've thought about file naming schemes and choosing suitable names on and off over the years, most recently in December when I was setting up my gopherhole and phlog. I jotted down the beginnings of this post in mid-January, and the past few nights I've been spending a bit of time writing my current thoughts and opinions, to finally put this out in the world, in case anyone else might find this interesting or have any thoughts about it. If so, I'd be very happy to hear from you about your thoughts on this, whether it be in the context of file names of phlog/blog posts and gopherholes/websites, other use-cases, or regular files in general. yyyy-mm-dd or yyyymmdd ---------------------- A date makes for a nice and short file name, but it doesn't convey any information about what's in the file on its own. For example, a file name 2020-07-13.txt tells me nothing about what is inside, and I would need to open it to find out -- which I may not always want to do, for one reason or another. I feel like in the spirit of being able to tell what I'm getting into before opening a gopher link (I'm thinking of the item type prefix in URLs), I would also like to know what I can expect in a file beyond its general type. hyphenated-title ---------------- Descriptive, hyphenated or single word file names are a favourite of mine. I especially like to use them in collections where dates don't matter as much, for example if the material are in a sense 'timeless' and can be expected to be maintained, kept up-to-date, and/or remain relevant long after they are initially written and published. On my own gopherhole and website, my notes, talks, and generic pages (e.g. contact page) follow this naming scheme. For example: gopher://gopher.gnu.ca/0/~bandali/talks/jami-empowers-users.txt https://www.gnu.ca/~bandali/talks/jami-empowers-users.html gopher://gopher.gnu.ca/0/~bandali/bandali-computing.txt https://www.gnu.ca/~bandali/bandali-computing.html I prefer relatively short URLs for my gopherhole/website pages. So, for each new page, I spend some time to come up with a concise and descriptive page name/title, resulting in an equally short file name. The file names can sometimes be further shortened by omitting articles like 'the', 'a', and 'an'. As one may expect, this is a rather popular naming scheme, and one that seems to be a naturally good fit for many use-cases. I have come across many gopherholes and websites that use it for the file names of various kinds of pages and/or entries. My phlog post file names also initially used this scheme, but within about a week of writing the first post I moved on to the naming scheme described below. [ Update: I'm back at using this for my phlog posts again. -- 2023-07-08 ] [ Update: I'm now using this for my articles, and yyyy-mm-dd-hyphenized-title for my phlog posts again. -- 2023-08-12 ] yyyy-mm-dd-hyphenized-title or yyyymmdd-hyphenized-title -------------------------------------------------------- This is a hybrid of the first and second naming schemes described above. It is the one I use for this phlog, and more generally the one I would use for other use-cases where the dates are important, where the collection could be considered an excursion, a journey, or a progression over time which inherently lends itself well to being sorted and browsed chronologically. [ Update: this is the naming scheme I used for my phlog posts for over a year, but ultimately decided on using simply the hyphenated-title (described above) for my phlog as well. My rationale is that (1) I really like short URLs, and (2) I wasn't using the main attraction of this approach to me, which automated generation of a list of posts as described below. Instead, my 'index' files serve as the source of truth for order of posts, and I'm okay with that. -- 2023-07-08 ] [ Update: I'm now using this naming scheme for my phlog posts again. -- 2023-08-12 ] Before deciding on yyyymmdd-hyphenized-title file names for these phlog posts, I considered yyyy-mm-dd-hyphenized-title. I like that the hyphenated yyyy-mm-dd dates are a bit more readable, but ultimately chose to go with the non-hyphenated ones for a couple of reasons: they are slightly (two characters) shorter, and not using a hyphen to separate the components of the date results in the date looking as a single unit and be visually more distinct from the (hyphenated) words that follow it. Besides being easy to sort chronologically and being descriptive, another benefit of this naming scheme is that it yields relatively unique file names. This is especially useful in the context of gopherspace, where one can easily save a copy of a phlog post for reading later by simply downloading an entirely self-contained plain text file -- in contrast to HTML pages, which may have external dependencies such as external CSS. Having a descriptive, dated file name helps the potential reader/visitor get an idea of what it is generally about and when it was published before even opening it, and the relative uniqueness means a lower probability of collision with other files, should the reader choose to simply download/save a copy. Another useful aspect of this is automation: for instance, to generate a list of my phlog posts in reverse chronological order, I can fire up a terminal, cd (change directory) into the phlog directory, and run ls -1r | grep -v 'gophermap' The '-1' switch to ls tells it to list one file per line, and '-r' tells it to use reverse order while sorting. Finally, I exclude the gophermap file (analogous to an index.html file for websites) using an inverse grep ('-v' tells grep to select any line that does not match the given argument). This can be easily extended and further tweaked to fit the use-case at hand. For example, adding the following line to a gophermap file for a phlog in a gopherhole hosted by the Gophernicus gopher server would insert a list of the phlog post files in that directory into the gopher menu for that directory (the '=' in the beginning tells Gophernicus to run the remainder of the line in a shell and substitute the output into the gopher menu in its place): =ls -1r | grep -v 'gophermap' | xargs -d'\n' printf '0%s\t\n' Others ------ Two unusual naming schemes I've seen around gopherspace are randomly generated names like tmp.gCHDzGlDqn as created by mktemp from GNU coreutils, and Unix time like 1648258589 (signifying the number of seconds since 1970-01-01 00:00:00 UTC, the Unix epoch). I personally don't see myself using either of these for my own posts or pages, but they're certainly interesting to see, and no doubt the folks choosing to use them have their valid reasons. For instance, perhaps, removing the burden of deciding on a more descriptive file name altogether if a random one would suffice. If you know of any other interesting and/or unusual file naming schemes, or you'd like to share your thoughts about any of the ones mentioned in this post, I'd be happy to hear from you; you can find my email address at the end of the post. Closing thoughts ---------------- In this post I outlined my thoughts and current opinions about file names, particularly in the context of phlogs or blogs, and gopherholes or websites, and gave reasons as to why I think each one may be more or less suitable for a particular use-case. It's not my intention to invalidate anyone, their use-cases, and/or their choices in any way when it comes to this, and as always my inbox is open to your thoughts, comments, and feedback. :) Take care, and so long for now. bandali@gnu.org