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

+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

+1 on this request – I’m working on a large writing project and started using a “concepts” property and sometimes several notes in, the variable that I used as the concept property becomes a MOC so then I have a linked MOC version of the variable and a variable that is unlinked term so I have to manually go back and find all the files with the unlinked variable and manually change them to the linked MOC. A way to do all of this through the overarching menu on the side would be fantastic!

I have recently started using VS code - how are you doing this?

1 Like

Here’s a workaround using templater, made by @"quote" on Discord: Discord

They added this disclaimer though:

so in theory you could use this for all of those “oh no, my Frontmatter has tag and i need it to have tags whatever shall i do” scenarios. In theory. Hopefully. Please don’t sue me. And if you are going to sue me, at least make backups of your notes before using it so you can have your notes and get a nice windfall from the lawsuit

Given that there is already a panel for showing all properties in all files, renaming, removing and other property management should totally be possible there. That would make intuitive sense and without it properties are just text scattered around in files rather than a solution to metadata management.

4 Likes