Templater Parsing Error and tp.file.move

Things I have tried

Tried looking through these help docs and wasn’t able to find anything.

What I’m trying to do

Running MacOS Mojave with Templater version 1.9.9

Trying to insert template contents into a note using Templater while also moving the note into a folder. I have this pasted into the template note:

<% tp.file.move(“4-Archive/Videos/”) + tp.file.title) %>

This is my file. Video Template.md (173 Bytes)

I get an error message when I try to insert the file in which is says “Parsing error, aborting. Please check console.”

This might help…

I have a Templater script set up to rename(move) yesterday’s Daily Note into a storage folder. The newest version of Templater has a new “script” feature, where you create a template with the script and it runs in the background when Obsidian starts.

I tried using MOVE but it didn’t work and someone else here helped me with the following.

Maybe you can get the new note to move itself, like you wanted, but I tried that and no one knew how to accomplish that double action (create and move).

This is not what you are trying to do, but it might give you some ideas.

const date = tp.date.now(“YYYY-MM-DD”,-1)
const file = tp.file.find_tfile(date)

if (file) {
const name = file.basename
await app.fileManager.renameFile(file, 001 DAILY/PAST/${name}.md)

I’m not sure but I am successfully using move. In my case I notice that I have a forward slash before the directory name (eg. before the “4”) and that you also seem to have an extra bracket. Try this:
<% tp.file.move(“/4-Archive/Videos/” + tp.file.title); %>

You have an extra closing parentheses. It should be:

<% tp.file.move(“4-Archive/Videos/” + tp.file.title) %>

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