README file from
GithubConsistent Attachments for Obsidian
Consistent Attachments keeps your vault tidy by moving (or copying) note attachments when notes move between folders.
Why this plugin
In many vaults, attachments drift away from their notes over time:
- notes are moved, attachments stay behind
- shared files are hard to handle safely
- folder structures become inconsistent
This plugin automates the common cases while preserving control for edge cases.
Feature highlights
- Automatically process attachments on note folder moves.
- Support shared attachment handling with
skip,copy, orask. - Choose destination behavior:
- follow Obsidian default
- note subfolder
- same folder as note
- fixed vault folder
- Avoid overwrites with automatic numeric conflict suffixes (
-1,-2, ...). - Scan for orphaned attachments with filter, sort, and cleanup actions.
- View a recent in-memory operation log.
- Run manual actions from command palette and file context menu.
Installation
Community plugins (recommended)
- Open Settings -> Community plugins.
- Select Browse.
- Search for Consistent Attachments.
- Install and enable the plugin.
Manual installation
- Download or build these files:
main.js,manifest.json,styles.css. - Copy them into:
<Vault>/.obsidian/plugins/consistent-attachments/
- Reload Obsidian and enable the plugin.
Quick start
- Enable Auto-move in plugin settings.
- Select a target path mode that matches your vault layout.
- Move a note to another folder.
- Review moved/copied attachments and open the operation log if needed.
Settings reference
- Enable auto-move: turn automatic processing on note move events on/off.
- Shared attachment strategy:
skip: keep shared files in placecopy: keep original, create note-local copyask: prompt for every shared file
- Target path mode:
Follow Obsidian defaultSubfolder of note(configure subfolder name)Same folder as noteFixed vault folder(configure fixed path)
- Delete empty attachment folders: remove note-local attachment subfolders left empty after a move.
- Excluded folders: ignore note moves inside selected paths.
- Show notices: display operation summaries in Obsidian notices.
- Operation log size: max number of entries kept in memory.
Commands
Move attachments for current noteApply attachment layout to vault— scan all notes and move attachments to match the current target path settingsFind orphaned attachmentsShow recent operation logToggle auto-move on/off
Additionally, the file explorer context menu for markdown notes contains:
Move attachments for this note
Shared attachment behavior
When another note also references the same attachment, the plugin applies your configured strategy:
- Skip: do nothing to the shared file.
- Copy: create a copy at the destination path for the moved note.
- Ask: open a decision modal during the operation.
Conflict handling
The plugin never overwrites existing files. If a destination filename already exists, it appends a numeric suffix:
image.pngimage-1.pngimage-2.png
Limitations and non-goals
- Link parsing is optimized for standard wiki and markdown links.
- The orphan scan uses Obsidian's link index plus markdown link parsing; rare edge-case references may still be missed.
- The operation log is in-memory only and resets on reload.
- No cloud service is required; processing is local to your vault.
Troubleshooting
- Attachments are not moved
- verify Enable auto-move is on
- check excluded folders
- note-only renames in the same folder are intentionally ignored
- Unexpected skips
- check shared attachment strategy
- inspect the operation log modal
- Conflicts occur often
- adjust target path mode to reduce filename collisions
Privacy and security
- No telemetry is collected.
- No external network service is required for core functionality.
- File operations stay inside the Obsidian vault.
- Vault access (local only, via Obsidian APIs):
- Apply attachment layout to vault and auto-reconcile enumerate markdown notes with
vault.getMarkdownFiles()and read note content withvault.cachedRead()to resolve linked attachments. - Find orphaned attachments enumerates vault files with
vault.getFiles(), builds a reference set frommetadataCache.resolvedLinksand from markdown notes viagetMarkdownFiles()/cachedRead(), then lists unreferenced attachment candidates. - Move attachments for current note only reads the active note and files referenced by that note.
- Excluded folders in settings are skipped during vault-wide scans.
- Apply attachment layout to vault and auto-reconcile enumerate markdown notes with
- Orphan cleanup in the modal moves files to the vault trash via Obsidian's trash API.
Development
Requirements:
- Node.js 18+
- npm
Commands:
npm install
npm run build
npm run lint
npm run dev