Ignore/exclude completely files or a folder from all obsidian indexers and parsers

I’m learning about this overlay filesystem. I’m reading that the lower layer is read-only. Doesn’t this prevent you from using Obsidian to update notes?

Nope, the lower directory is only read-only from the context of the overlay mount directory :slight_smile:

Some key points:

  • Use the Obsidian vault as the lower directory
  • Keep using Obsidian via the lower directory directly
  • Create “invisible” files/directories via the overlay mount

In the overlay mount, you have the identical directory structure and the same files as in the Obsidian vault, but you are free to create new files and directories which will only be stored in the “upper” directory

The overlay mount is basically just a merged version of the lower/upper directories, and any changes you make in the overlay mount will only be made in the upper directory

Example:

Let’s say you have a vault, named FooVault at ~/FooVault

You would keep using Obsidian directly on ~/FooVault

Create the following directories for the upper/work dirs:
~/FooVault.diff
~/FooVault.work

These directories are to be used by the overlay mount, but you would generally not access them directly. Just create them for now.

Then you want a directory through which you would be able to create directories and files within the context of the vault, but without actually being stored in the vault. Let’s just go with:

~/foo

After creating the ~/FooVault.diff, ~/FooVault.work and ~/foo directories you run:

sudo mount -t overlay overlay -o “lowerdir=$HOME/FooVault,upperdir=$HOME/FooVault.diff,workdir=$HOME/FooVault.work” ~/foo

Let’s say that within FooVault you have a directory such as:

~/FooVault/Projects/Bar

Within this directory you have a bunch of notes and other things related to the Bar project.

This directory and all the files will also be visible at:

~/foo/Projects/Bar

Let’s now say that you have a GIT repo with source code related to the Bar project, you can now store this in:

~/foo/Projects/Bar/src

Under the hood, this will create:

~/FooVault.diff/Projects/Bar/src

When you are using your terminal/IDE/whatever, you’ll access it via the overlay mount at ~/foo, which will see everything combined from both ~/FooVault and ~/FooVault.diff

But when you are using Obsidian (+ in case you want to edit notes or reorganize your vault using any other tool) you would do it via ~/FooVault directly and not via ~/foo

The main thing to keep in mind, besides doing things that should be “invisible” to Obsidian within ~/foo and making any modifications to the vault itself (adding/editing notes, moving vault folders around) via ~/FooVault, is that in case you want to do something like:

Moving ~/FooVault/Projects/Bar to ~/FooVault/Projects/SomethingElse

From the context of the overlay mount at ~/foo you would now have

~/foo/Projects/Bar/src (mapped to ~/FooVault.diff/Projects/Bar/src) as well as ~/foo/Projects/SomethingElse

So to account for that, in case you’re moving folders around in ~/FooVault you need to move them in ~/FooVault.diff as well

1 Like

Hmm that part seems scary. Not sure I full understand. But good to keep in mind if I ever look at overlays.

Thanks for sharing this clever idea!

1 Like

Also note that some of the issues mentioned in the following help topic also relate to this FR: Stuck on Loading cache - #76 by FernandoIbrahim
I came across the topic since i already forgot that obsidian indexes everything and was wondering why it was taking so long to start after running experiments that created 125k files with a total of 20GB. Now I either have to clear the cache before starting obsidian and have it gobble up RAM while using a core full time while trying to index all the files in the background or throw my current folder structure overboard…
This is the second use case that I ran into personally where the option to exclude files would be great.

I wanted to throw in supporting this feature request. It feels like a must-have to me for software with the scope of Obsidian.

Logically speaking it’s a bit strange that Obsidian doesn’t have this feature already, considering that it already restricts what types of files it shows you. Why does Obsidian index or otherwise pay attention to files that are not shown within its user interface?

My own use case is that I have a folder for a project, and within that folder I have a number of git repositories. It’s very convenient for me to have the files organized this way, and it’s also very convenient to have the top-level folder be an Obsidian vault. However, whenever I actively work on one of the git repositories, Obsidian eventually hangs, I suppose because too many files are changing too quickly for it. Being able to exclude the folders, or even just the .git subfolders, would fix this issue and allow me to work the way I want.

4 Likes

I also think, this would be a huge feature, which is probably comparatively easy to implement.

This feature is basically already implemented via Files and links > Excluded Files. Maybe just copy this setting, name it Ignored Files and skip those files and directories altogether.

For large vaults this could mean a significant improvement.

2 Likes

Another use case, that this feature request would resolve: hiding temporary files created by Microsoft Office. Why should Obsidian index or display them at all?

6 Likes

I just want to weigh in on the issue: I think it can be a real show stopper even for potential commercial users as I could be. The users who use Obsidian as doc management system on their big monorepos with built binaries, dist/, node_modules/ etc. For me it makes it a real pain to open a vault as it reindexes hundreds of modules which don’t belong to my code.

Is there a way I can contribute to have it implemented?

Also, I’d like to add my two cents - excluding node_modules, .git, and, more generally, any unwanted files or folders is a critical feature for me. Especially since the Excluded files feature does not actually exclude but marks them as hidden.

1 Like

Have to have this feature.

I’ve made a monorepo for all my projects and notes which are applicable across projects.

When I open Obsidian, it freezes on me(too many projects?).

In order to use Obsidian I planned to be able to open it, view all my code snippets/framework snippets/cli commands across all my projects at the same time so that I can build on them(think project 1.helloworld, 2.intermediate-hiworld 3.pro-hola-world etc).

However being unable to open Obsidian is a buzz kill.

I’ll also add that I preemptively created a new vault, added the “projects” folder to the “files exclude” settings, and then copied my folders over manually 1 by 1. Despite that Obsidian immediately froze when I drag and dropped the projects directory into the vault.

I used

/Projects/
/Projects/*
/Projects/**

Any suggestions?

Obsidian has been really buggy for me for quite a while - I was losing faith! Now I finally know why!

I had assumed that “Excluded Files” was really excluding the folders that I added there, and I rarely reboot (or restart Obsidian) so it wasn’t until just know that I noticed the indexer taking too long.

Please make “Excluded Files” really exclude, or some way to achieve this!

1 Like

This is pretty much what is keeping me from onboarding obsidian at this point, have had my home folder as my wiki for years, and this works great. But it does mean that all my .md files are mixes in between code projects and so forth. So without some sort of .obsidianignore functionality obsidian just hangs if I try to create a vault in my home folder.

So an upvote from me on this, I’ll watch the thread and hopefully this is something that will be implemented at one point.

2 Likes

Yes this is much needed - want to have my project folders and collaborative repos inside the folder scheme of my vault. Better exclusion rules/features would help a lot.

1 Like

Been two years since I had to put Obsidian on hold because of the lack of this feature. I’m sure many developers are in the same boat as me.

@WhiteNoise says themselves that Obsidian already ignores ‘dot’ folders (e.g. .git) here.

Seems like a simple thing to extend the index exclusion that already exists. This should be a relatively small change with a rather large payoff (opening a new customer segment).

And not just for hobby developers - but large enterprises with many large repositories that have .md files everywhere and need a great way to navigate them, make them more useful and tie them all together.

I would be happy to submit a PR myself, if I had access to Obsidian’s repo.

1 Like

I don’t think Obsidian should refer to .gitignore. A separate file .obsidianignore folder would be great, so that such code, binaries, and external that isn’t part of the functionality of the Obsidian tooling can be excluded thus not resulting in broken indexes and slow-downs in starting time in Obsidian.

Please please pleeeeease include .obsidianignore feature please, where when a path is defined (relative or absolute, wildcards included - just like in .gitignore) those defined files will not be included in indexing at all for Obsidian. Also it would not show in Obsidian such files (I think this is already good, because no binaries or applications are shown, but I just wanted to mention the scope - both indexing and visibility of the excluded files).

This topic seem to be a quite a popular one. I gathered all I could find over below so someone who’s interested have all of them (from what I found) in one place:

Config to ignore/hide select files and folders - Feature archive - Obsidian Forum

Ignore/exclude completely files or a folder from all obsidian indexers and parsers - Feature requests - Obsidian Forum

Set up a WSL development environment | Microsoft Learn

Any tips for .gitignore style exclusion of vault directories? : r/ObsidianMD
https://www.reddit.com/r/ObsidianMD/comments/13wq5fr/any_tips_for_gitignore_style_exclusion_of_vault/

Config to ignore/hide select files and folders - Feature archive - Obsidian Forum

Ignore Files / Folders - Basement - Obsidian Forum

Ignore folders in vault option - Feature archive - Obsidian Forum

Exclude certain folders - Help - Obsidian Forum