## 概要
今開いているファイルをベースにして、同じディレクトリファイルにファイルを複製したい。前回の内容をベースに作成したい場合など。
## ソリューション
### オススメ
`Make a copy of the current file`コマンドを利用します。
### [[Templater]]を使う
`Make a copy of the current file`コマンドの挙動をよりカスタマイズしたい場合は[[Templater]]のスクリプトで自作することもできます。
```js
<%*
const f = app.workspace.getActiveFile()
await tp.file.create_new(
tp.file.content,
`${f.basename}--copied.md`,
true,
f.parent
)
app.commands.executeCommandById("workspace:edit-file-title")
%>
```
> [!info] コマンドにホットキーを登録する方法
> [[Templaterで作成したコマンド(スクリプト)をホットキーで実行する方法]] を参考にしてください。