What I’m trying to do
I am trying to add a tag to muliple notes that all have the same property.
Example: For all the notes with the property “status” and the value “1” I want to add the tag “high”.
Things I have tried
I searched up in the help docs and forum:
- bulk edit
- meta data edit
- add tag
- property edit
I have tried
I have tried tag wrangler, but thats only to change tags.
I have tried vscode, but thats only for search an replace, not add.
I have tried the plugin db folder, but that didnt added any tags to mulitple notes at once
The closest I have been was with a unpopular plugin called “Multi Tag”. I was able to add one tag to muliple notes that are in the same folder. It would be helpful to know how to add multiple notes with the same specific property to one folder at once, but I guess thats the next rabbit hole.
So my question ist: How can I add one tag to muliple notes, that all have the same specific property, at once?
I would use VS Code, I think, to do this. The trick is to search for “status: 1”, and replace with “high\nstatus: 1”…
Just replace with the searched content and add whatever you want to it. Then a search-and-replace also becomes an add operation.
Thanks for your help. But it is not the solution. I tried it and it didn’t work.
It changed the “status: 1” property to “high\nstatus: 1: 1”. So just the property name changed and no tag was added to the property “tags”
Hehe… the example was just that, ang example. You need to properly type out what your replacement should be, but it will work with the correct replacement string.
However, for it to work with Tags it do depend on the order of properties and so on. If that’s not a given, you might be better off doing a dataviewjs (or another script variant), where you for the files to be changed, and then call
processFrontMatter() (if it’s named that still) to add your custom tag.
Just downloaded it, make.md looks like a good step in the right direction. However, I only have managed to create spaces. I wasent able to add one tag to mulitple notes at once. Is there a trick to it?
okay, I got it. It works with “make.md”. Thanks a lot!
I installed the plug in “make.md” und searched in the search bar of “make.md” für the property I needed. I marked all the files, draged on droped them into a folder. And with the plug in “Multi Tag” I was able to just add the tag with one click.
Hello, you can also attain the desired outcome using a Python script, which reduces security risks compared to installing additional plugins. To each their own.
Before you begin, it’s wise to create a backup of your vault. Ensure you set the directory to your vault or the folder you’re working with.
# Function to check if the status is 1 and add 'high' to tags if it is not present.
# Flags to check if the 'property: status' and 'value: "1"' are present
has_status = False
value_is_one = False
tags_index = -1
# Iterate over the lines to check the flags and find the index of tags
for i, line in enumerate(lines):
if line.strip() == 'property: status':
has_status = True
elif has_status and line.strip() == 'value: "1"':
value_is_one = True
tags_index = i
# Check if 'high' is already in tags
if 'high' in line:
return False # No need to process further if 'high' is already a tag
# If the status is 1, add 'high' to the tags
if has_status and value_is_one and tags_index >= 0:
if '' in lines[tags_index]: # Handle empty tag list
lines[tags_index] = lines[tags_index].replace('', '[high]')
lines[tags_index] = lines[tags_index].rstrip() + '\n - high\n'
# Function to process each markdown file
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the start and end of the header
header_start = -1
header_end = -1
for i, line in enumerate(lines):
if line.strip() == '---':
if header_start < 0:
header_start = i
header_end = i
if header_start >= 0 and header_end > header_start:
header_lines = lines[header_start+1:header_end]
lines[header_start+1:header_end] = header_lines
with open(file_path, 'w', encoding='utf-8') as file:
# Function to traverse the folder and process all markdown files
for root, dirs, files in os.walk(folder_path):
for filename in files:
file_path = os.path.join(root, filename)
# Replace 'your_folder_path_here' with the path to the folder you want to process
folder_path = 'your_folder_path_here'
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.