Skip to content

greg-fox/folder-rules

Repository files navigation

Folder Rules

An Obsidian plugin that automates note management by creating rules to move notes between folders based on metadata.

⚠️ Important: Always maintain regular backups of your notes

This plugin automatically moves files based on metadata changes. While it includes safeguards against rule loops, it's important to:

  • Keep regular backups of your vault
  • Test rules in a safe environment first
  • Use the debug mode to understand how rules are being applied
  • Review the plugin's behavior before applying rules to important notes

Features

  • Create rules to automatically move notes based on their metadata
  • Configure rules on a per-folder basis
  • Support for multiple conditions per rule
  • Multiple matching types:
    • All conditions must match (AND)
    • Any condition can match (OR)
  • Three types of metadata matching:
    • Exact matching
    • Contains matching
    • Regular expression matching
  • Folder path completion for easy rule configuration
  • Debug mode for troubleshooting
  • Prevention of rule loops

How to Use

  1. Enable the plugin in Obsidian settings
  2. Click the folder-plus icon in the ribbon to toggle the plugin
  3. Open the plugin settings to configure rules

Creating Rules

  1. Click "Add Rule" to create a new rule
  2. Configure the source folder (where notes will be monitored)
  3. Configure the destination folder (where matching notes will be moved)
  4. Choose the match type:
    • "All conditions must match": All conditions must be satisfied
    • "Any condition can match": Any single condition can trigger the rule
  5. Add conditions:
    • Click "Add Condition" to add a new condition
    • Specify the metadata field to check
    • Choose the matching type (equals, contains, or regex)
    • Enter the value to match against

Example Rules

  1. Move notes to "Projects/Active" when:

    • Source folder: "Inbox"
    • Match type: All conditions
    • Conditions:
      • status equals "active"
      • priority equals "high"
  2. Move notes to "Archive" when:

    • Source folder: "Projects"
    • Match type: Any condition
    • Conditions:
      • status equals "completed"
      • status equals "archived"

Debug Mode

Enable debug mode in the plugin settings to see detailed information about:

  • Metadata changes
  • Rule evaluation
  • Condition matching
  • File movements

Debug information appears in the Developer Console (View > Toggle Developer Tools > Console).

Installation

From Obsidian

  1. Open Settings > Community plugins
  2. Turn off Safe mode
  3. Click Browse community plugins
  4. Search for "Folder Rules"
  5. Click Install
  6. Once installed, close the community plugins window and enable the newly installed plugin

Manual Installation

  1. Download the latest release from the Releases section
  2. Extract the files into your vault's plugins folder: <vault>/.obsidian/plugins/folder-rules/
  3. Reload Obsidian
  4. If prompted about Safe Mode, you can disable safe mode and enable the plugin

Development

  • Clone this repo
  • Make sure your NodeJS is at least v16 (node --version)
  • npm i or yarn to install dependencies
  • npm run dev to start compilation in watch mode

Support

If you find this plugin helpful, please consider supporting its development:

  • Star the repository
  • Report bugs or suggest features
  • Submit pull requests

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An Obsidian Plugin to automate note management on a per folder basis

Resources

License

Stars

Watchers

Forks

Packages

No packages published