Skip to content

Copy and rename a file instead of moving it #1206

Answered by GNeulaender
GNeulaender asked this question in Help
Discussion options

You must be logged in to vote

I do think now I found a solution using some of your code. Thanks for the help!

<%*
const reference_file = app.vault.getAbstractFileByPath("FILEPATH");
const current_file = tp.file.path(true);
const new_file = file.substring(0,file.length - 3) + ".pdf";
await app.vault.copy(reference_file, new_file);
-%>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@GNeulaender
Comment options

@GNeulaender
Comment options

Answer selected by Zachatoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants