lunan195 downloadsVisual dashboard for intelligently cleaning orphaned files and attachments with scheduled auto-cleanup and file protection.
An Obsidian plugin for intelligently cleaning up orphaned files and attachments in your vault.
.vault-trash) for easy recoveryA file is considered orphaned when it meets ALL of the following conditions:
A file is classified as an attachment if it matches your configured attachment paths:
| Path Type | Example | Matching Logic |
|---|---|---|
| Absolute path | attachments |
File parent path or file path starts with it |
| Relative path | ./attachments |
File path starts with attachments (default) or any parent directory name matches attachments (alternative algorithm) |
.obsidian/ and other system folders

Quick access via Obsidian's command palette (Ctrl/Cmd + P):
.obsidian/plugins/ directory| Setting | Description | Default |
|---|---|---|
| Delete Strategy | Move to custom trash or permanent delete (dangerous) | Custom trash |
| Custom Trash Path | Folder location for deleted files | .vault-trash |
| Recently Modified Protection | Files modified within this many days are protected | 7 days |
| Whitelist Folders | Folders excluded from scanning (one per line) | None |
| Setting | Description | Default |
|---|---|---|
| Enable Auto-Cleanup | Automatically clean orphaned attachments on schedule | Disabled |
| Cleanup Interval | Frequency of auto-cleanup execution (days) | 3 days |
| Check on Vault Open | Run auto-cleanup check when vault is opened | Enabled |
| Check on Plugin Load | Run auto-cleanup check when plugin is loaded | Enabled |
Note: Auto-cleanup only affects attachments and will not delete note files, ensuring your important content is safe.
| Setting | Description | Default |
|---|---|---|
| Override Attachment Folders | Custom attachment storage locations (one per line) | Follows vault settings |
| Ignore Patterns | Regex patterns; matching files will be excluded | None |
| Test Settings | Test if a path is ignored (red = ignored, green = kept) | - |
| Alternative Attachment Algorithm | Enable if attachments in subfolders are not detected | Disabled |
# Clone the repository
git clone https://github.com/wlunan/vault-cleaner.git
cd vault-cleaner
# Install dependencies
npm install
# Development mode with hot reload (watches for changes and rebuilds)
npm run dev
# Build for production
npm run build
npm run dev to start the development servertest-vault folder in Obsidian as a vaultnpm run build to build the plugin.obsidian/plugins/vault-cleaner/ directory:main.jsmanifest.jsonstyles.cssnpm run dev for auto-rebuild, then reload Obsidian to see changes.hot-reload in your vault rootnpm run dev - changes will auto-reload without restarting Obsidian# Bump version (updates package.json, manifest.json)
npm run version
# Commit and tag
git add .
git commit -m "Release vX.Y.Z"
git tag vX.Y.Z
git push && git push --tags
Create a new release on GitHub with the built files (main.js, manifest.json, styles.css).
src/
├── main.ts # Plugin entry point, registers commands and ribbon icon
├── dashboardModal.ts # Visual cleaning dashboard
├── scanService.ts # Orphan file scanning service
├── actionService.ts # File operation service (delete/restore)
├── previewModal.ts # Delete preview confirmation modal
├── autoCleanScheduler.ts # Scheduled auto-cleanup scheduler
├── settings.ts # Settings interface
└── locales/ # Internationalization language packs
├── zh-CN.ts # Chinese
└── en-US.ts # English
MIT