Excluding/Including Folders in Graph View

Things I have tried

Read these posts and searched the web, but still don’t understand:

What I’m trying to do

Often I want to exclude certain folders from the graph view to reduce noise from irrelevant folders, or I want to search just one or two folders, etc. Seems this wasn’t possible from earlier posts, but now seems like it can be done, but I’m a bit lost as to how to do this in the various scenarios: show 1 or more folders, exclude 1 or more folders, etc. As I’m new to this software, a step-by-step explanation would really help! thanks!

1 Like

Hi, @romebot.

First of all, this is where the graph filtering happens. Just getting that out of the way:

Screenshot 2021-03-24 at 15.09.15

Now, you’ll need to use some combination of the following:

  • the path: selector
  • the negation (-) operator
  • the OR boolean operator (Obsidian’s search defaults to AND)

So, let’s say you want the graph view to only show your daily notes (stored in a folder called Daily Notes):

path:"Daily Notes"

If, instead, you only want to see notes that are not inside the daily notes folder:

-path:"Daily Notes"

If you want all your daily notes and all your recipes, you can have something like this:

path:"Daily Notes" OR path:"Recipes"

(note that boolean operators must be uppercase)

To exclude subfolders, you can do this:

path:"Recipes" -path:"Spam" -path:"Eggs"

I’ve been focusing on the path selector, but you can combine it with others:

path:"People" -tag:#coworker

Does this help? If you’re still unable to accomplish something, you’ll need to give us some concrete examples.



This is genius. Thanks! So, just to clarify: In the example above, is this just looking in the Recipes folder, but excluding Spam and Eggs, or is it looking at all folders, minus spam and eggs? If it’s the latter, how do you get Obsidian to look in one folder but exclude a sub-folder. Or conversely, how if it’s the other way, how do you designate “all” folders, except…

Scenario 2: What if I have sub, sub folders?

Eg. Let’s say I want to include all folders except Blog 1 and Blog 2

900 - Sources
-----930 - Blogs & Newsletters
----------Blog 1 Folder (which contains many documents that I do not want to include)
----------Blog 2 Folder (include)
----------Blog 3 Folder (which contains many documents that I do not want to include)

Or let’s say I just want to look in Sources, but exclude the same two folders.
Or let’s say I want to look in Sources + One other folder, but both have excludes.

Sorry if that’s confusing, but I have very specific search criteria to get the least noise in the results.



Notes in the “Recipes” folder, excluding its “Spam” and “Eggs” subfolders.

If you want all the notes in your vault, except the ones in those two subfolders:

-path:"Recipes/Spam" -path:"Recipes/Eggs

To exclude “Blog 1” and “Blog 3” (assuming “Blog 2” was a typo"):
-path:"900 - Sources/930 - Blogs & Newsletters/Blog 1 Folder" -path:"900 - Sources/930 - Blogs & Newsletters/Blog 3 Folder"

path:"Sources" -path:"900 - Sources/930 - Blogs & Newsletters/Blog 1 Folder" -path:"900 - Sources/930 - Blogs & Newsletters/Blog 3 Folder"

You may need to group conditions with parenthesis:
(path:"Sources" -path:"Sources/Foo") OR (path:"Bar" -path:"Bar/Baz")


To show only the notes in your vault root (i.e. excluding all subfolders): -path:"/"


This is amazing-thanks! Last questions… I’m assuming that for those operator lines that display on two lines, that’s just where the paragraph breaks, but you didn’t put in a paragraph break there. Also, in the last example, just so I understand how it works, what happens if you put “AND” there? And you said “AND” was default, so assuming I wanted it, do you just leave a blank space? or is it better to write it?

I lied, one more! sorry. :slight_smile:

In this example, you’re looking only in the People folder, except notes tagged “coworker”
path:“People” -tag:#coworker

What about other scenarios? E.g. look in People, but only those tagged w/ “coworker” (I assume just take out the minus sign), or search the whole database for “coworker” except in the folder “Fired for insubordination” :slight_smile:

Right. it’s a single line.

Then the graph would be empty, because a note can’t be located in two folders.

I can’t recall ever needing the AND in Obsidian, but I don’t often make complex search queries. Try without the AND first. If it works, problem solved; if it doesn’t, use it.

My advice to you is to test different real-life scenarios and experiment a lot. You can’t really break anything from filtering the graph, so just go crazy. If/when you’re really stumped, let us know.

and if I can bother you just for the above… other than that I will be experimenting a lot for sure! really appreciate your help. (on another note, I have a couple posts that didn’t get any answers… what’s the etiquette? should I post again, or just wait if no one answers?

@romebot: I don’t know what the etiquette is, but I would imagine no one would mind if you do some further research and create a new post outlining anything interesting you may have found despite not being able to solve the issue.

I have done this in the past and people got involved and kindly helped me. This isn’t saying that they were ignoring my initial help request, but rather that they probably just happened to see the second post.

I probably wouldn’t recommend just bumping the post without adding any additional information. But that is just me.



path:"People" tag:#coworker

tag:#coworker -path:"Fired for insubordination"

Regarding etiquette (I’d rather call it efficiency), I believe some best practices are:

  • reading the documentation
  • making sure your question hasn’t been answered before
  • avoiding very broad questions
  • keeping it as short and focused as possible
  • providing real examples
  • creating separate topics for different issues

Hope this helps. Cheers.


thanks so much!

1 Like

I’m having trouble with filtering the graph with tags.

In general, using tag:#coworker doesn’t work at all, only w/o “tag:” (also tried tag: #coworker, with a space)… I’ve also tried adding “path” to the mix, but something isn’t right…

if I use just #coworker, it works, but this doesn’t allow me to search for combined tags or the exclusion of tags… maybe I’ve got the syntax wrong?



Here is the help page for search operators: Search

thanks. I’ve been there, it’s just a bit over my head. :slight_smile:

Please add screenshots of this so we can try and help:

Thank you so much for this! I was trying similar syntax but in the wrong place haha (groups) which sounds silly now but oh well. Cheers.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.