I’ve cobbled together a Templater script to move a note to a secondary vault. In my initial testing, it works well. One caveat…
The folder/directory path on the secondary vault has to be the same as the source file. For example, if you try and copy path/to/note
and path/to
is not created already on the secondary vault, the script will fail. There are ways to do some checking and create the folder, but that involves more than I want to invest. Having said that, this is a very useful script for my workflow and am glad to have figured it out.
Here is how I use this script. I created a note titled CopyNoteToOtherVault
in my templates directory with the script code below. I setup a template hotkey in the Templater plugin settings. I then created a note titled CopyNoteToOtherVault LOG
. This acts as a running log of all files that are copied. The return value of the script is appended to this note. You can see the return value at the end of the script. I have it returning an Obsidian URI, but you can customize however you like. Then, finally, I call the script via the command menu or hotkey.
NOTICE: This script copies files and will overwrite any file with the same title. Use at your own risk.
To first use, in the script, you must uncomment the line of code that copies the file.
change:
// fs.copyFile(
to:
fs.copyFile(
Edit and add your vault(s) to the myOtherVaults
array.
Run the Templater script!
Here is a short demo video … using some demo vaults.

Let me know how it goes. All feedback is appreciated.
<%*
// array of full paths to other vaults
const myOtherVaults = [
'/path/to/vault/vault-one',
'/path/to/vault/vault-two'
];
// node.js fs (https://nodejs.org/api/fs.html)
const fs = require('fs');
// callback for copyFile
function callback(err) {
if (err) throw err;
// console.log( '"' + myVaultPath + '/' + fileToCopy + "\"\ncopied to\n\"" + myOtherVault+ '"' );
new Notice( '"' + myVaultPath + '/' + fileToCopy + "\"\ncopied to\n\"" + myOtherVault+ '"' );
}
const myPath = '';
// all files
const myFiles = this.app.vault.getFiles()
.filter(f => f.path.startsWith(myPath))
.map(f => f.path);
// current vault path
const myVaultPath = this.app.vault.adapter.basePath;
// suggester for file to copy
const fileToCopy = await tp.system.suggester(myFiles, myFiles, false, "Select the file to copy");
// suggester for destination vault
const myOtherVault = await tp.system.suggester(myOtherVaults, myOtherVaults, false, "Select the destination Vault");
// vault name only for Obsidian URI
const myOtherVaultName = myOtherVault.split('/').pop();
// copy file
// fs.copyFile(myVaultPath+'/'+fileToCopy, myOtherVault+'/'+fileToCopy, callback);
// return file link or Obsidian URI
// return fileToCopy ? `- [${fileToCopy}](file://${myOtherVault.replace(/ /g,"%20")}/${fileToCopy.replace(/ /g,"%20")})\n` : '';
return fileToCopy ? `- [${fileToCopy}](obsidian://open?vault=${myOtherVaultName.replace(/ /g,"%20").replace(/\//g,"%%2F")}&file=${fileToCopy.replace(/ /g,"%20").replace(/\//g,"%%2F")})\n` : '';
%>