Properties Wrangler: Add a way to "Insert", "Rename" and "Remove" properties and values in all files

Use case or problem

The new Properties feature is fantastic. Now that it's here, ideas are flowing. One idea could help those of us who seem often to "refactor" notes by changing metadata, etc. There is some sweet new functionality already with the new Properties feature, but the ability to edit all files in the vault with some commands would be awesome, similar to Tag Wrangler. Currently it is a manual job to rename or remove properties, and this takes a lot of time even in modestly sized vaults.

Proposed solution

Add new commands for Properties:
  • “Remove this property and associated values from all files”
  • “Rename this property in all files”

Current workaround (optional)

I'm sure someone smarter than me could write a script or something to do this, but that person is certainly not me! So, for me, the current workaround is to go through files, one by one, and change everything manually.
157 Likes

Please rename this FR with a more discoverable title.

3 Likes

Thank you! Done.

2 Likes

I absolutely agree.

Properties feature is GREAT and I can see Obsidian heading in directions like Tana or Notion on the back of this - hopefully expanded - feature.

I, too wish for more capabilities in the realm of Tag Wrangler. The plugin is great and I use it a lot. But there are many aspects where I’d wish for more:

  • Autocomplete for the editing field (existing tags to be suggested)
  • Batch replacing tags with more than one tag (tags 1 → tag1, tag2, tag 3)

As much as I like Tag Wrangler, I’d wish for Obsidian to provide such crucial functionality as core plugin.

15 Likes

+1 for this feature!

I was just checking if I should add this request. These two features would be incredibly effective in getting some needed organisation in my vault.

@WhiteNoise and everyone who has contributed to making this feature possible, thank you!

3 Likes

properties are beautiful, when i first re-launched obsidian i found i had 200+ property fields dataview, breadcrubm and yaml , most of them are useless
being able to remove properties would be great

7 Likes

This function would be very, very useful.
Noone can reorganize the vault note for note.

3 Likes

This would be very useful. I used a plugin to add date fields to my notes and no longer need nor want them. Unfortunately, the plugin didn’t offer a way to remove the Properties it had created and I can’t find another way apart from using regex in a terminal, and relearning how to do that would take time I don’t have.

5 Likes

+1 for me.

Those with 2k+ notes and a bunch of different property keys (some that may have been used a bit haphazardly) would definitely benefit from these commands, to keep everything neat, tidy, and consistent.

4 Likes

Definitely want this, just want to add that IMO any such refactors shouldn’t affect mdate (Date Modified) to avoid (meta)data loss.
It would be awesome if that kind of metadata was tracked by Obsidian using frontmatter, especially since properties have datetime support, so I’ll shamelessly plug this FR here: Handle file creation date / modified date internally

3 Likes

Hi,
as a workaround you might use any script language for walking through all files and change the property name. I’m not a programmer, but I asked ChatGPT to write me a script. Maybe somebody with more python expertise can check it. For the moment it works on a copy of my Vault and I currently don’t see any problems. Here is the script, you can call it by python3 script.py /file/path/to/vault "prop2change" "newpropname"

import os
import sys
import re

def update_strings_in_file(file_path, old_string, new_string):
    try:
        with open(file_path, 'r') as file:
            lines = file.readlines()

        updated_lines = [line.replace(old_string, new_string) for line in lines]

        with open(file_path, 'w') as file:
            file.writelines(updated_lines)

        print(f"Updated {file_path}:")
        for line_num, (old_line, new_line) in enumerate(zip(lines, updated_lines)):
            if old_line != new_line:
                print(f"Line {line_num + 1}:")
                print(f"  Old: {old_line.strip()}")
                print(f"  New: {new_line.strip()}")
    except Exception as e:
        print(f"Error updating {file_path}: {e}")

def process_markdown_files(root_folder, old_string, new_string):
    for folder_path, _, file_names in os.walk(root_folder):
        for file_name in file_names:
            if file_name.endswith('.md'):
                file_path = os.path.join(folder_path, file_name)
                update_strings_in_file(file_path, old_string, new_string)

if __name__ == "__main__":
    if len(sys.argv) != 4:
        print("Usage: python script.py <root_folder> <old_string> <new_string>")
        sys.exit(1)
    
    root_folder = sys.argv[1]
    old_string = sys.argv[2]
    new_string = sys.argv[3]
    
    process_markdown_files(root_folder, old_string, new_string)
5 Likes

Thanks for sharing this! I think it’s a bit technical for me but I appreciate that it gets the ball rolling!

I just figure out, that my script above touches markdown every file in my vault, so the modifying date will be change on all files. So still be careful with scripts created by AI. For me it’s not an issue, cleaning up my properties and tags are worth it for me :slight_smile:

2 Likes

I posted a post Feature Request: Renaming a property updates all references which I think is relevant / duplicate of this thread. I am going to close that one and join conversation here.

Thank you @whitenoise for cross-posting

3 Likes

+100 for me. My notes have properties added my templates and by the note exporter applications that I used to get notes out of other notes app so that I can import them into Obsidian.

It’s quiet the mess that will take me years to clean up manually.

1 Like

Hi,

Another case for me is when I’m toying with DB-folder and tidying the properties.
I was left with some remnants of properties when I’m toying the column name and properties type.
It’d be really nice to have a way to remove properties from the “properties view” side pane.

BTW, I don’t understand why would the “properties view” list the remnant properties with 0 instance.
image

2 Likes

I’m pretty sure you can just delete them out of <path_to_Obsidian>\.obsidian\types.json and if they’re at 0% usage then they’ll disappear inside Obsidian. I had to edit this file when I had accidently used a capitalized letter for a property name

Great band-aid for now, but I think having the in-app functionality to modify/delete properties and their values with a click is more aligned with the philosophy of building a user-friendly properties editor at all, and to the overarching mission of making it as good as possible.

But thanks for the tip! I’ll try it and hopefully it will work in the short-term.

3 Likes

+1. I don’t always want to edit every single file in my vault though (which is still a good idea for streamlining/reorganizing, managing imports, and cleaning up what’s not used anymore). I’d like a per-folder approach to this as well.

In Notion I used to manage collections in various databases, and each had their own set of properties applied to every page within. I am currently doing the same in Obsidian by keeping each entry as a file in a folder, which is why I’d like to right-click on a folder or something and make all properties within that folder consistent.

2 Likes

I use VS Code to mass-rename or delete proprties (you can regex-replase text in several files at ones here), but I agree It would be more convenient to be able to do this directly from Obsidian.

5 Likes