The Templater docs here seem to indicate that tp.file.move() takes a second parameter (in bold). I’m hoping this parameter would make it possible to find and move a file that isn’t the current file but I’ve never seen any examples of this parameter being used. Maybe I’m misunderstanding the documentation.
tp.file.move(new_path: string, file_to_move?: TFile)
My use case involves moving pages returned by a Dataview.js query. The below results in a “TypeError: The “path” argument must be of type string. Received undefined” error.
const dv = this.app.plugins.plugins["dataview"].api
const lastIcons = dv.pages('"FOLDER/Subfolder"')
.where(p =>
p.file.path.includes("subfolder1") != true &&
p.file.path.includes("subfolder2") != true)
.forEach(async p => p.file.name.includes("Something here") == true ?
await tp.file.move("/FOLDER/Subfolder/subfolder1/" + p.file.name, p.file.path) :
await tp.file.move("/FOLDER/Subfolder/subfolder2/" + p.file.name, p.file.path))
Would anyone be able to show me how this second parameter in tp.file.move()
can be used?