farux / obsidian-auto-note-mover

This is a plugin for Obsidian (https://obsidian.md).
MIT License
290 stars 22 forks source link

Added Dynamic Folders + Compatibility with Temlater #42

Open ggstrader opened 1 year ago

ggstrader commented 1 year ago

If Templater is detected, you can associate a template file with a rule so that it is run automatically when the file is moved.

Due to some kind of caching problem, the template is executed before the file is renamed, otherwise templater complains that the file doesn't exist. I would think that awaiting the rename call would mean the rename is complete, but apparantly not.

How to use:

ggstrader commented 1 year ago

Note: I also updated the package config since npm detected vulnerabilities

ggstrader commented 1 year ago

closes #37

ggstrader commented 1 year ago

Example for "Dynamic Folders" (capture group):

Folder = Subjects$1, Tag = #subjects(/[^/]*/?)?

This regex places anything with the "subjects" tag in the "Subjects" folder, and any nested tags in the first nested folder.

Tag Folder
#subjects Subjects
#subjects/literature Subjects/literature
#subjects/literature/french Subjects/literature
#subjects/physics Subjects/physics
evanhammer commented 1 year ago

:heart:

leelhn2345 commented 1 year ago

hi, is there anyway i can use this PR's version for my vault??

ggstrader commented 1 year ago

hi, is there anyway i can use this PR's version for my vault??

Option 1 - Use BRAT

Install BRAT from community plugins and add https://github.com/ggstrader/obsidian-auto-note-mover. This is probably the easiest option

Option 2 - Clone and Build

You'll need to install Git, and NodeJS

Then open a terminal in your vault's .obsidian/plugins directory and git clone https://github.com/farux/obsidian-auto-note-mover.git. This command just copies this repository, you can also download a zip of the repo on the main page to avoid using Git. When it's downloaded, open a terminal in that directory and run npm i followed by npm run dev. This produces the main.js.

ManikandanUV commented 1 year ago

@ggstrader Thanks for this PR. Is it possible to make more nested folders instead of placing everything in the first nested folder? My structure is work/active-projects/sentiment-analysis, work/active-projects/world-domination, work/inactiv-projects/altruism, etc. Only creating the first nested folder still keeps my notes messy.

ggstrader commented 1 year ago

@ggstrader Thanks for this PR. Is it possible to make more nested folders instead of placing everything in the first nested folder? My structure is work/active-projects/sentiment-analysis, work/active-projects/world-domination, work/inactiv-projects/altruism, etc. Only creating the first nested folder still keeps my notes messy.

It can do anything regex can do, so yes. I recommend looking up some info on regex. regex101.com is a great resource for learning and constructing regex.

ManikandanUV commented 1 year ago

It can do anything regex can do, so yes. I recommend looking up some info on regex. regex101.com is a great resource for learning and constructing regex.

That worked, thanks! For anybody who would need this, here is what I set to create as many nested folders as needed

Tag = #subjects(/.*)

Folder = subjects$1

ManikandanUV commented 1 year ago

@ggstrader Could you kindly pull the PR from jeffbeaulieu:move-all-notes-command into your repo and publish a release? I tried forking both your repos and published a release, but looks like I need to build them with npm, and I'm getting some build errors.

utils/Utils.ts:39:13 - error TS2339: Property 'plugins' does not exist on type 'App'.

I'm a python developer, and know zilch about node, so it would be great if you could pull these changes into yours. I have tons of notes that I want processed.

ggstrader commented 1 year ago

@ManikandanUV it looks like @brossell (above) has forked this repo and is actively maintaining it, so maybe it's best to request there.

connradolisboa commented 5 months ago

@ManikandanUV it looks like @brossell (above) has forked this repo and is actively maintaining it, so maybe it's best to request there.

Do you know how I can use that fork repo? I don't understand how I can use title regex for moving or using the name of the children tag for specifying the path of the moved note.