Move a file based on templater suggester function

Hi all

In my project template, I’d like to prompt the user and move the file based on his answer.

Here is my current template :

date: {{date}}
tags: [project]
title: {{value}}
status: active
type: project
scope: <% await tp.system.suggester(["Cwt", "Curuba"], ["Cwt", "Curuba"])%>
<% await tp.file.move("/" + tp.frontmatter.scope + "/Projects/" + tp.file.title) %>

It returns this error: File name cannot contain any of the following characters: * " \ / < > : | ?

If I run both command individually it works. Therefore I guess that templater doesn’t wait the frontmatter update before trying to move the file.

Any suggestion?


Hi Bastien,

Your code works fine over here. Could it have something to do with a clash between Templates/Templater? (I have no idea if that is an issue, just thinking out loud). I changed only foldernames and no problem moving.

1 Like

Thanks for your answer.
I didn’t find why it was not working.
I ended up with a one-block script directly in the frontmatter

1 Like

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