Hiding files in the file explorer: a weird one

Things I have tried

I’ve managed to get a CSS snippet working to hide a specific file from file explorer, using this:

.nav-file .nav-file-title[data-path$='filename.md']
{
    display: none;
}

What I’m trying to do

The specific file I’m trying to hide is (I think) generated by Dropbox on MacOS, called “Icon?” in the Finder, and while it’s treated as hidden by Finder, it has no dot prefix, so Obsidian shows it. Worse, the “?” appears to actually be some kind of newline character. (Learned that here, which suggests the file name is actually Icon\r or Icon^M.)

How do I target that file using that CSS? Is there a way to represent a newline that will actually match it? Is there a way to accommodate a partial match? I know this isn’t really an Obsidian-specific question, but I’m hoping some of the resident CSS-wizards know the answer.

The file is the only non-folder in my root, so a possible workaround might be to just hide files in the root that aren’t folders.

You have three kinds of substring selectors, see: W3C :: Selectors Level 3

In your example [data-path$="filename.md"] you don’t need a substring selector, [data-path="filename.md"] would do it.

For your file try this one [data-path^="Icon"], it matches all files which start with “Icon”.

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