For organizational purposes I would like a certain filesystem object which most of the time appears as a file, on occasion, to appear as a directory.
The basic idea is that generically for
locate, I would like the object to appear as an individual file. For other applications such as
okular, I would like it to appear as a directory. Can someone suggest a mechanism for doing this?
To illustrate let me give an example:
I will give the object I have in mind the name _my_books_on_m4_programming.arch_. For the purposes of moving/copying or find/locate this object looks like a file, but when I want to read a book in the object it looks like a directory ie: for the command
I have thought of two and a half possible solutions but would need help with either one.
The first is to modify my linux to use a special attribute of the file system. If the attribute is set then I look for an environmental for example
SPECIAL_OBJECT_IS_FILE. If it is set I treat it as a file. If it is not set I treat it as a directory. The problem with this approach is that I do not see how to implement it without modifying virtually the whole system.
The second technique would be to store the files in an archive (e.g. tar, zip, rar) which I mount (rw) to some directory. To treat the object as an archive refer to the original archive, to treat the object as a directory refer to the mount point. Is this possible?
The half technique is simply a twist on the second instead of mounting an archive I create someking of link to it. Is anything like this possible?
I can't believe that no-one else ever wanted to do a similar thing so I suspect that there is some way. Suggestionss?
Ok. I confess I had trouble coming up with a title for my question, so I tried to make a joke out of a very old commercial--sorry.