Assign tag to multiple files

Is there a way to assign the same tag(s) to multiple notes at once?

5 Likes

Other than one by one? I don’t think so, except really ugly hacks with external scripts

1 Like

Yes, I meant “batch adding” of a single tag to multiple files.

ie: You have Ford, Fiat, Chrysler, VW, Audi… etc files and you want to tag them all with #carbrand

I didn’t realize something like this was not possible.

1 Like

How is the list of files going to be specified?

  • Selection of files in file Explorer within Obsidian?
  • Files refered by collection of links within some markdown file?
  • All files contained in folder and its subfolders?

Edit thanks WahWah for clarification↓.

  • list copied from search results
1 Like

Like in most apps where this is any easy thing: search across all notes for a subset you want to tag. Use REGEX to get said set, select all results. Use the tag option to tag all entries in the set. Done.

1 Like

From Obsidian Release v0.9.3

When using global search, you can now copy the search results file list. This can be optionally formatted as wikilinks and/or as lists.

Now it is available as last icon above search text box. I do not know if API version of this command exists.

I think this request could be best done as a plugin.
I do not know if it is better then to store it in feature-requests or plugin-ideas category.

The plugin could:

  • add custom hotkeys for even faster use. Especially when Single key hotkeys (context sensitive) become supported.
  • have options whether to add tags:
    • to standard front-matter field “tags”
    • in some other syntax/place
  • have option to insert only those tags that are not assigned yet to given note
    • in YAML front-matter field “tags”
    • in some other syntax/place
1 Like

Since tag support is already a core feature of Obsidian, I would argue this feature request is best implemented as a core feature. As @WahWah said, this is pretty standard in apps that support tagging.

As to the specific UI implementation, @malecjan mentions several good options. As with other file management actions, I think it makes sense to let the user do it in several different ways. Using the File Explorer and Search Results seem to be the most compatible with Obsidian’s current UX.

File Explorer

First, multi-select of files in File Explorer, then
→ right-click menu “Add tag to selected files”
→ command palette “Add tag to selected files”
→ drag selected files to the tag in the tag pane OR drag the tag from tag pane to the selected files

Search Results

First, perform a search query that give results, then
→ click a new # button (next to the ‘copy search results’ button) to assign a tag to all notes in the search results

3 Likes

I’m all about this feature. I’d just like to add that there also needs to be a way to REMOVE a tag. So if there is a context menu or command palette item for “Add a tag to selected files”, there should also be one for “Remove a tag from selected files”.

4 Likes

@Gem, this may help:

By the way, an example of free software that can mass search and replace is VSCode.

Thanks

We need an interface that can manage labels systematically, and more abundant label functions.

Thank you but I’m not talking about editing or removing a tag at the global level. I meant removing a tag from, say, 5 selected files out of 100 that have that tag. Really just the inverse of adding a tag to multiple selected files.

1 Like