Is it possible to make a custom mime type for directories (inode/directory)?
Just like what MacOS does with *.app folders (app bundle) which make it possible to open them in another program.

  • Do you mean associating MIME types, in a browser, with directories? Commented Feb 4, 2022 at 12:17
  • @Greenonline I mean like when you create a mime type xml which is installed with xdg-mime. Is it possible to make a mime type like this but for directories?
    – Bytez
    Commented Feb 5, 2022 at 16:49
  • This isn't an answer, but see MIME type for a directory and see man xdg-mime and maybe try to experiment with that. I think that answer will depend upon the OS used.. Commented Feb 6, 2022 at 15:48
  • Did you find anything new so far?
    – WGRM
    Commented Jul 24, 2022 at 18:36
  • I'm trying to figure out what specific problem you're trying to solve. If you had the answer to your question, what would you be able to do that you can't do now?
    – MDeBusk
    Commented Jul 24, 2022 at 18:57

1 Answer 1


No. At least it won't work.

I have tried it several times and it does NOT work, while file associations work without any hassle. Here is some example:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-macos-app">
    <sub-class-of type="inode/directory"/>
    <glob pattern="*.app" case-sensitive="false" weight="100"/>
    <comment>macOS Application</comment>
        <treematch path="path/to/Test.app" type="directory" match-case="false" />

This must be placed in ${HOME}/.data/mime/packages. Update via update-mime-database "${XDG_DATA_HOME}/mime/"

I'm pretty certain, that this is a bug, noone noted or cares about. So you may file it, to draw attention. Please report back, if you get other results.

It actually should work, as shown by this example, which makes sense:

<mime-type type="x-content/image-dcf">
  <comment>digital photos</comment>
    <treematch path="dcim" type="directory" non-empty="true"/>

Source Spec


I tried with path="Test.app", again. But it didn't work either. It is described, that it looks within the mounted root. I tried both, with and without sub-folders.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .