How important is to have datetime info in the filenames?

I noticed, by default Org-roam makes files with datetime prefixes. I didn’t like that because they also show up in Org-agenda, so I did this:

(setq org-roam-capture-templates
      '(("d" "default" plain
         (function org-roam-capture--get-point)
         :file-name "${slug}"     ;  <---------- see?
         :head "#+title: ${title}\n#+created: %u\n#+last_modified: %U\n#+roam_tags:${tag}\n\n"
         :unnarrowed t
         :immediate-finish t

But now I’m thinking, the datetime prefixes make it easier to sort the records. But I don’t care about how they sorted. Probably I don’t care at all how they are organized on the disk. But maybe Roam caching system does? If it gets to a massive number of files (like tens of thousands)? Perhaps I should keep the datetime prefixes in the names? Or it doesn’t really matter?

1 Like

I don’t think it matters.
Looking at the source code below, Org-roam takes modified time along with other file attributes from the filesystem. This does not rely on the filename to have a time stamp string, as far as I can see.

(defun org-roam-db–insert-meta (&optional update-p)
“Update the metadata of the current buffer into the cache.
If UPDATE-P is non-nil, first remove the meta for the file in the database.”
(let* ((file (or org-roam-file-name (buffer-file-name)))
(attr (file-attributes file))
(atime (file-attribute-access-time attr))
(mtime (file-attribute-modification-time attr))
(hash (org-roam-db–file-hash)))

So why then the default org-roam-capture-template uses ":file-name “%<%Y%m%d%H%M%S>-${slug}” is there some hidden benefit I’m missing?

Why not?

It makes the filename unique even when you have the same title. Saying that, nevertheless, I would not say that is a benefit.

It will come to personal preference, I think, like you prefer not to have timestamps.

Personally, I prefer timestamp-only without the slug (I don’t want a long title cluttering my file names). I like to be able to sort files in my OS by timeline (I prefix most of my files’ name with a timestamp especially the ones I use for work — Word, PPT, Excel).

It makes search with Windows Explorer very easy. It seems that human memory is good at remembering sequence of events in time (not sure scientifically evidenced, but i read about it somewhere) I can roughly remember when I made the file. I just apply the same concept to Emacs.


I believe having the timestamp in the filename (or the timestamp as the entire filename) is a deliberate approach of some digital Zettelkasten systems, although I can’t recall what the reason is.

Personally I also removed the timestamp. I’ve not noticed any problems yet.

I didn’t find any benefit to it, and the main reason for me to remove it was as a simple way to avoid having the timestamp in the URL when I publish via org-publish. For something I consider to be a personal wiki, for me it doesn’t make sense to have the creation date in the URL.

(There may be a way to have the timestamp in the filename, but remove it when publishing - that could be useful.)

1 Like

@doubleloop, great input :slight_smile:

Just as I was going through my notes, etc. I re-discovered where my timestamp in the filename came from.

They may be old, but are still good read, and might give readers some “time-tested” ideas for organising their digital files.

File System Infobase Manager dated 2009
Scrivener as Dedicated Research Database dated 2009, but the original idea seems to have been discussed around 2007

I chanced upon them around 2011. Since then, I have “more or less” kept my files (notes, images, work related files) with timestamps.

From about 10 years of this practice (!), I can say I would not use my PC without it.

Is this the only way? No, I don’t think so.

Is this objectively better than “no timestamps”? I do not know. Like I said, I believe it’s a matter of personal preference. But timestamps as a prefix (not suffix, because that way, you cannot sort by timeline) have been essential for my sanity.

I might add the “slug” back in the filename – it seems to make the file content easier to browse in a list (Windows Explorer, or Emacs Dired)…

1 Like

Linking to this thread, where the same question is discussed.