Jens Eldering1k downloadsSync Obsidian folders to external directories. Supports multiple folder pairs.
A plugin that syncs vault folders to external directories, one-way or two-way per folder pair.
![[image.png]], ) are
copied next to the note in the destination, even when they live in a central attachments folderClone or copy this project anywhere (it does not need to live inside your vault):
git clone <repo> local-folder-sync
Install dependencies and build:
cd local-folder-sync
npm install
npm run build
This produces a single bundled dist/main.js, plus dist/manifest.json and dist/styles.css.
(Obsidian's plugin loader requires one bundled file — it can't require() between separate
plugin files — so npm run dev/npm run build always emit one bundle, not the raw TypeScript output.)
Copy dist/'s contents into your vault's plugin folder:
mkdir -p "<vault>/.obsidian/plugins/local-folder-sync"
cp dist/main.js dist/manifest.json dist/styles.css "<vault>/.obsidian/plugins/local-folder-sync/"
Enable the plugin in Obsidian under Settings > Community plugins, then fully restart Obsidian if you're updating an already-loaded plugin (module load failures can be cached for the running session).
Same as above: build, then copy dist/main.js, dist/manifest.json, and dist/styles.css
into <vault>/.obsidian/plugins/local-folder-sync/.
Open the plugin settings to:
Interval (sync every N minutes) or On Change (sync as soon as a file changes)Interval triggerNotes/Project)/Users/Jens/Documents/Backup)One-way (source → destination, deletes extra destination files) or
Newer file wins (two-way, never deletes)![[image.png]])
are copied into the note's folder in the destination. Options: Auto (default),
Always, Never — see Embedded files following below.Folder Sync: Sync all folders nowNotes often embed files that live outside the synced folder. When Obsidian stores new
attachments in a central folder (e.g. media/), a note only contains ![[Screenshot.png]] —
that file would never reach the destination alongside the note. When the embed pass runs,
the plugin scans every generated note in the pair's source folder for embeds, resolves each
one the same way Obsidian does (MetadataCache.getFirstLinkpathDest), and copies the resolved
file into the note's folder in the destination.
Each pair controls this with the Embedded files option:
'./'), the scan is skipped entirely —
attachments already live next to their notes, so the regular sync copies them anyway.
Any other value (a central folder, the vault root, a subfolder of the current folder)
enables the scan. If the setting cannot be read, the feature degrades to "off".Behavior details:
![[image.png]] links,
which resolve when the synced folder is opened as a vault in Obsidian.On Change auto-sync when it lives outside the synced folder; the updated copy goes out
with the next sync.local-folder-sync/
├── src/
│ ├── main.ts # Main plugin class, auto-sync, watchers, status bar
│ ├── settings.ts # Settings UI
│ ├── sync.ts # Sync logic (one-way and newer-wins)
│ ├── types.ts # TypeScript types
│ ├── manifest.json # Plugin metadata
│ └── styles.css # Custom styles
├── esbuild.config.mjs # Bundles src/ into a single dist/main.js
├── package.json # Node dependencies
└── tsconfig.json # TypeScript config (type-checking only)
# Development mode (watches for changes)
npm run dev
# Production build
npm run build
This plugin includes a link to Buy Me a Coffee for optional user support. Clicking the "Buy me a coffee" button in the plugin settings will open this external website.
MIT