Subtract the hidden png files from the total number of files

I’ve kept the png files hidden using some css snippet but now I want to get the actual number of files excluding the hidden png files. Is there any solution?

Use case or problem

To not get confused with how many files are there in total. png/jpg files should be excluded.

Proposed solution

In some plugin format or css snippet

Current workaround (optional)

So I’ve used some css snippet to hide png and then created one more to hide jpg files. It’s there somewhere in the forum’s.

EDIT: Use holroy’s refined search which removes the need to do math:

Then bookmark that search.


Original suggestion:

In the vault search put

path:/.png$/ OR path:/.jpe?g$/

Then bookmark that search. When you want to know the true number of files, subtract the number of search results from the total number of files.

1 Like

So in other words, you could do this vault search and get the total number of files (or would this include non-existing files? I don’t think so, but not sure):

-path:/.png$/ -path:/.jpe?g$/

Similar request could most likely also be done using javascript and get the the entire list of files, and then filtering out the files you don’t want.

2 Likes

Good thinkin’! :slightly_smiling_face:

(Search only returns notes that exist.)

2 Likes

Thanks it works!

Thanks for the help!

Yea would be cool to make it into a plugin. But it’s not much of a concern I guess.

If ChatGPT helps you with something that you adapt, test, and get working for yourself, great! Please share!

But, please don’t copy/paste ChatGPT answers here. The Obsidian Group Discord message when someone posts a ChatGPT “answer” →

Thanks for trying to help! However, asking ChatGPT or any other LLMs (Large Language Models) is discouraged in our community because their responses often contain outdated information or straight-up misinformation. If you don’t know the answer, that’s fine! Other community members can help with unanswered questions.

Thanks :fairy:

1 Like

What @ariehen said.

I’ve deleted the comment containing unverified ChatGPT code.

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