Does templater have the equivalent of the unix/macos dirname command?

Things I have tried

I have tried extensive searching and looking through documentation for dataview and templater, all to no avail.

I have a template file with these lines in it:

  path:  <% tp.file.path(true) %>
  fullpath:  <% tp.file.path(false) %>

When I load it into a file, I get these (correct) values:

  path:  templates/templater-tests/level01/level02/level03/
  fullpath:  /Users/ge/Dropbox/obsidian/testbed/templates/templater-tests/level01/level02/level03/

I’m looking for a way to imitate the linux/macos ‘dirname’ command:

~/testbed $ ls templates/templater-tests/level01/level02/level03/ 

~/testbed $ dirname templates/templater-tests/level01/level02/level03/ 

In other words, I’d like the results of <% tp.file.path(true) %> without the final file name.

Is there a way to do it?

Thanks for your help.

  • ge, chapel hill, nc

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.