What I’m trying to do
I’d like to make a note template (ideally using templater) that moves the current note to a procedurally generated vault folder, populates it, and creates a corresponding folder template elsewhere on my machine.
The template would contain sub-folders and create a readme file.
Things I have tried
I have achieved my first aim, sending the note and making the template. However, I’m struggling to create a note outside of my Vault. The code I have below is in the template, and it seems that the await this.app.vault.createFolder function just creates the folder within the vault with the name:
“/Full/Path/To/Other/Folder/Location/” + titleName
Any suggestions how I can create the directory elsewhere and then push the titleName and ShortSummary into a readme file?
<%* let qcFileName = await tp.system.prompt(“Project title (Proj-YYx-Title)”)
titleName = qcFileName.replace(“:”, " -")
await tp.file.rename(titleName)
FolderPath = “Projects/” + titleName + “/”
if (!tp.file.exists(FolderPath)) {
await this.app.vault.createFolder(FolderPath)
}
ProjectFolder = “/Full/Path/To/Other/Folder/Location/” + titleName
if (!tp.file.exists(ProjectFolder)) {
await this.app.vault.createFolder(ProjectFolder)
}
const fs = require(‘fs’);
await tp.file.move(FolderPath + titleName)
let ShortSummary = await tp.system.prompt(“Short project summary”) ;-%>
[Project folder](file://<%ProjFolder%>)
Start date: <% tp.file.creation_date() %>
End date: Ongoing
Short summary:
<% ShortSummary %>