move_note
Relocate or rename notes within your Obsidian vault by specifying current and new file paths.
Instructions
Move or rename a note to a new path
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| oldPath | Yes | Current relative path of the note | |
| newPath | Yes | New relative path for the note |
Implementation Reference
- src/lib/vault.ts:142-157 (handler)The moveNote function implementation, which resolves paths, checks for existing destination, and performs the rename operation.
export async function moveNote( vaultPath: string, oldPath: string, newPath: string, ): Promise<void> { const fullOldPath = resolveVaultPath(vaultPath, oldPath); const fullNewPath = resolveVaultPath(vaultPath, newPath); try { await fs.access(fullNewPath); throw new Error(`Destination already exists: ${newPath}`); } catch (err) { if ((err as NodeJS.ErrnoException).code !== "ENOENT") throw err; } await fs.mkdir(path.dirname(fullNewPath), { recursive: true }); await fs.rename(fullOldPath, fullNewPath); }