Note Attachment Folder

approvedunreviewed

by CharlesChou

Organizes note attachments into a same-name folder and syncs the folder and links when notes are renamed, moved, or deleted.

↓ 15 downloadsUpdated 2d agoMIT

Note Attachment Folder

English | 简体中文 | 日本語

An open-source Obsidian plugin (minAppVersion: 1.6.6) that automatically saves pasted and dropped attachments into a dedicated folder matching the note's name, and keeps that folder and all note & canvas links synchronized whenever the note is renamed, moved, or deleted.


Why This Plugin?

Obsidian's built-in Default location for new attachments setting falls short when you want one dedicated, self-contained folder per note:

  • Saving to the vault root clutters your top-level directory.
  • Saving to "Same folder as current file" mixes images and Markdown notes in the same directory.
  • Saving to "In subfolder under current folder" forces a static name (such as assets/), mixing attachments from different notes in the same folder.
  • Renaming or moving a note leaves static attachment folders behind without renaming them.

Note Attachment Folder solves this end-to-end with three configurable folder modes and automatic lifecycle synchronization.


Screenshots

Live path preview, folder location, and paste & drop capture

Image naming template and sync options

Batch link sync, deletion cleanup, exclusions, and historical archive


Features

  • Automatic Capture on Paste & Drop: Intercepts pasted images and externally dropped files (images, PDFs, audio, video, and other attachments) and saves them straight into the active note's dedicated folder.
  • 3 Configurable Folder Modes:
    1. Unified root folder (Default): Notes/MyNote.md → attachments/Notes/MyNote/20261123143000_a1b2c3.png (or flat attachments/MyNote/...)
    2. Same directory, same-name folder: Notes/MyNote.md → Notes/MyNote/...
    3. Same directory with custom suffix: Notes/MyNote.md → Notes/MyNote.assets/...
  • Automatic Rename & Move Sync: When a note is renamed or moved to another directory, its attachment folder moves/renames with it, empty source folders are cleaned up when switching modes, and images can optionally be renamed to match your template (renameImagesOnSync).
  • Batch Link Sync & Repair (One Consolidated Notice): Updates all .md and .canvas links silently in a single pass and emits one summary notice instead of per-file Obsidian popups—preserving relative (./, ../), URL-encoded (%20), and CJK links while skipping code blocks and external URLs.
  • Safe Delete Cleanup: Optionally moves the note's attachment folder to trash when the note is deleted—while automatically protecting folders that contain other notes or attachments shared by other notes.
  • Folder-Note Safe Guard: If a note uses the Folder Note pattern (e.g., Projects.md alongside Projects/SubNote.md), renaming Projects.md will never rename Projects/; only Projects.md's unshared attachments are migrated.
  • Selective & One-Click Historical Archive:
    • Selectively organize existing notes' attachments (Command Palette, Settings button, or right-click any folder): Scan existing notes, filter by folder or keyword, inspect shared attachment badges, and check/uncheck specific notes or individual files.
    • Organize current note attachments into its folder
    • Organize all vault attachments into note folders
  • Multilingual UI (English-First): Defaults to English, with built-in switching to 简体中文, 日本語, or Follow Obsidian.
  • Cross-Platform & Privacy-First: Uses only official Obsidian APIs (isDesktopOnly: false, works on Desktop & Mobile, zero telemetry or network requests).

Folder Modes at a Glance

Assuming a note at Notes/Design Doc.md and an attachment diagram.png:

ModeResult Path
root-folder (Default, mirror hierarchy on)attachments/Notes/Design Doc/diagram.png
root-folder (Mirror hierarchy off)attachments/Design Doc/diagram.png
same-dirNotes/Design Doc/diagram.png
same-dir-suffix (Default .assets)Notes/Design Doc.assets/diagram.png

Installation (Local / Manual)

  1. Build the plugin (or download main.js, manifest.json, and styles.css from Releases):
    npm install
    npm run build
    
  2. Inside your Obsidian vault, create the plugin directory:
    <YourVault>/.obsidian/plugins/note-attachment-folder/
    
  3. Copy main.js, manifest.json, and styles.css into that folder.
  4. In Obsidian, open Settings → Community plugins, reload the plugin list, and enable Note Attachment Folder.

Settings Reference

SettingDescriptionDefault
LanguageDisplay language (English, 简体中文, 日本語, or Follow Obsidian).English
Folder location modeChoose between root-folder, same-dir, or same-dir-suffix.root-folder
Root attachments folderBase folder used by root-folder mode.attachments
Mirror note folder hierarchyPreserve note subfolders under the root attachments folder.true
Folder name suffixSuffix appended to the note name in same-dir-suffix mode..assets
Intercept pasted attachmentsCapture clipboard images/files on paste.true
Intercept dropped attachmentsCapture OS files dropped into the editor.true
Only handle imagesRestrict capture and organize commands to images only.false
Excluded extensionsExtensions to ignore (md, canvas, base are always excluded).md, canvas, base
Pasted image filename templateSupports {{timestamp}}, {{date}}, {{notename}}, {{random}}, {{index}}.{{timestamp}}_{{random}}
Always rename pasted imagesApply template even when pasted file already has a non-generic name.false
Sync folder on note rename or moveRename/move attachment folder alongside the note.true
Rename images by naming template on sync or renameRename images inside the folder to match the filename template during sync/rename/organize.false
Batch sync and repair note linksUpdate all .md and .canvas links silently in one batch with one summary notice.true
Trash attachment folder when note is deletedMove unreferenced attachment folder to trash on note deletion.true
Shared attachments during organizeAction (skip, copy, move) when another note also links the attachment.skip
Excluded foldersVault-relative folder paths (one per line) ignored by the plugin.(empty)
Show status noticesShow notices for sync, cleanup, and organize actions.true
Restore default settingsReset all plugin settings back to their default values (with confirmation).—

Commands & Entry Points

  • Selectively organize existing notes' attachments (Command Palette, Settings button, or right-click any folder in the File Explorer): Opens the interactive Historical Archive modal to scan unorganized notes, filter by folder or keyword, inspect shared attachment badges, and selectively check which notes or individual files to archive.
  • Organize current note attachments into its folder (Command Palette or right-click any .md note): Scans all attachments referenced by the note and moves (or copies, depending on shared behavior) any scattered files into the note's configured attachment folder.
  • Organize all vault attachments into note folders: Runs vault-wide organization across all non-excluded Markdown notes in the vault (with a confirmation dialog).

Development

npm install
npm run lint       # Run ESLint (with eslint-plugin-obsidianmd)
npm run typecheck  # Run TypeScript type check
npm test           # Run Vitest unit & integration tests
npm run build      # Typecheck and bundle production main.js
npm run dev        # Watch mode during development

License

MIT

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.