Hello everyone. I’m trying to switch to linux from macOS but there’s a major hurdle: linux does not store creation date of files, apparently it’s completely irrelevant to the linux world.
I rely heavily on dataview for catalog my notes, and keeping them in creation-time order is a must for my type of work. How do you deal with this?
I know I can just retrieve creation time from my macOS finder and type it as YAML but I have 1k+ notes and I wouldn’t know how to do it, manually looks a chore. I also like to see my files ordered with creation time on my file explorer (not obsidian but desktop) and of course no file explorer can extrapolate creation time from YAML.
I’ve asked on several linux related forum, and the common answer was always: “you do not need creation time of a file, it’s pointless and thus it’s not on the kernel”, which is completely unhelpful.
Does anyone here have any decent solution for this problem? Thank’s.
Even with a file creation time, you can’t rely on that as it can get updated to the present time when syncing or copying a file (for example when migrating a vault to a new laptop).
Instead of using the unreliable file creation time, I add a
created value to the frontmatter on all new notes. I do this with a template so I don’t need to add this value manually.
Then in Dataview, instead of using
page.file.ctime, I use
If you decide to go that route, you could write a simple script to add it to your 1k+ existing notes, rather than do it manually.
Doing it with frontmatter property is more in-line with how any other PKM software works. Evernote/OneNote etc all have that as a property in the note data, rather than using system file time.
edit: Here’s the basic Templater template if it’s of use:
created: <% moment().format() %>
As an aside, you can get the file creation time in most(?) common Linux filesystems by typing
stat your_file_name from a terminal.
@AlanG Thank you very much!
I know how to use templater, enough to set a new note creation to follow that template.
Now my question is: how can I write such a script? I’m on macOS so the script would have to do something like:
- Check and store creation date of .md file
- Open the .md file
- If file already has a front-matter insert an empty line below the first line (
---) and insert
- If file does not have a front-matter, insert the three dashes, the creation date and lastly the other 3 dashes at the beginning of the file.
This goes completely out of what I’m able to achieve with mac CLI… any suggestion on how I could proceed? Thanks
Edit: re getting creation time in Linux, yes I know ext4 stores creation time, unfortunately when I move my vault from mac to Linux those time stamps does not get transferred, since mac is APFS.
Thank’s but please note that creation time is stored on macos, when I move files on linux the creation time is set to today; so if I check creation time trough ext4 stats it returns me it’s today.
Apparently no need for the script! I found a plugin called lint that retrieved all .md files creation date from system metadata and applied it to frontmatter - amazing
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.