obsidian-auto-note-mover icon indicating copy to clipboard operation
obsidian-auto-note-mover copied to clipboard

Added Dynamic Folders + Compatibility with Temlater

Open ggstrader opened this issue 2 years ago • 12 comments

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:

  • Install Templater from community plugins
  • go to the settings tab
  • there is now a fourth suggester, select a template file
  • create any file and trigger a move
  • you should see the template appended to the file

ggstrader avatar Jan 24 '23 02:01 ggstrader

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

ggstrader avatar Jan 24 '23 02:01 ggstrader

closes #37

ggstrader avatar Jan 25 '23 07:01 ggstrader

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

ggstrader avatar Jan 25 '23 07:01 ggstrader

:heart:

evanhammer avatar Jan 25 '23 18:01 evanhammer

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

leelhn2345 avatar Apr 02 '23 06:04 leelhn2345

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.

ggstrader avatar Apr 03 '23 20:04 ggstrader

@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.

ManikandanUV avatar Oct 11 '23 14:10 ManikandanUV

@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.

ggstrader avatar Oct 11 '23 14:10 ggstrader

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 avatar Oct 11 '23 18:10 ManikandanUV

@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.

ManikandanUV avatar Oct 11 '23 19:10 ManikandanUV

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

ggstrader avatar Nov 27 '23 10:11 ggstrader

@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.

connradolisboa avatar Jun 21 '24 18:06 connradolisboa