Skip Navigation

folders is inherently a bad idea

am regularly amazed that we pretend folders are the right way to organise files. They’re entirely arbitrary. Every competent file system ignores them to its best ability. Why can’t I have a file in two folders? Why does one have to be a “reference”? Why can’t I filter for files that exist in 3 folders with X extension?

We’ve been played for absolute fools.

31 comments
  • Why can’t I have a file in two folders? Why does one have to be a “reference”?

    All files are references. But you have always been able to put a reference to one file in multiple folders by using hard links.

    Why can’t I filter for files that exist in 3 folders with X extension?

    find dir1 dir2 dir3 -name '*.x' -type f

    • Yep. Even NT was doing it for decades. Though it was pretty discouraged on the Microsoft side.

    • We have hard links, but is there any good UI out there for them? I only know of using the ln command directly. Or put another way, do you know of anyone who actually uses hard links in a way similar to how a tagging filesystem would be used? What are the obstacles that prevent this use case from being easy or discoverable enough to be in common use?

      With a tagging system you can remove tags without fear of losing file data. But with hard links you could easily delete the last link without realizing that it's the last link, and then the file is gone.

      That relates to another issue: in a tagging system you can look at file metadata to see all of the file's tags. Is there a convenient way to do that with hard links? I see there is find . -samefile /path/to/one/link, but requiring a filesystem scan is not optimal.

      • Most people don't need a file to be in two places at once, it's more confusing than convenient. And if they do want two of a file at all, they almost certainly want them to be separate copies so that the original stays unmodified when they edit the second one. Anyone who really wants a hard link is probably comfortable with the command line, or should get comfortable.

        The Mac actually kind of gets the best of both worlds, APFS can clone a file such that they aren't hard links but still share the same blocks of data on disk, so the second file takes up no more space, and it's only when a block gets edited that it diverges from the other one and takes up more space, while the unmodified blocks remain shared. It happens when copy-pasting or duplicating a file in the Finder as well as with cp on the command line. I'm sure other modern file systems have this as well.

      • No, in nearly every case, you never want a hard link. You want one file, and symlinks to it. (Technically every file is a hard link to an inode, and subsequent ones are just additional links to the same inode.) In ext4, you can't easily get a list of links to an inode, you have to scan the filesystem and look for duplicates. Other filesystems might make this easier.

        You shouldn't try to use a tree filesystem to approximate a tagged database. Use the appropriate tool for the job.

  • Wait, I've got it: what if we put every file in one folder, and then hard-link the files we need higgildy-piggildy all over the place!

    We can call it WinSxS!

  • I know, instead of folders, we could use "shelves" and the Dewey Decimal System.

  • Why can’t I have a file in two folders? Why does one have to be a “reference”?

    You can do this... Hard links. Neither file is more "canonical" than the other.

  • No no, you see, most people like organisation. Also, it's intuitive as it is analagous to actual folders that store actual files. It would be kind of weird if you could store a file in multiple folders. What would that even mean? If you delete a file from one folder, is it deleted in the other? Folders aren't meant to be labels (labels are labels), they're locations. Your toothbrush is in the bathroom, pots and pans in the kitchen, etc.

  • you can do exactly what you're talking about, you just didnt bother to look it up. it is done the way it is because it is intuitive to organize things that way and it is a good way to make the actual organization of data on a storage device human readable. most people have no use for organizing things the way you are talking about 90% of the time, bit because usecases do exist where it is helpful it has always been possible to do that on linux. depending on the apps you use it may not be exposed graphically, but it can be done.

  • Not sure why people defend an archaic organization form here - reflex ?

    You are perfectly right that files and folders are simplistic, and should naturally adapt to the pov that are more information rich/valuable. Hoomans tend to collapse a high-dimensional structures to 0D to 3D, so we can manage the information. In that sense, a std hierarchy is only ONE pov over a ton of pov over the same content. A standard hierarchy is only a low 2D dimension structure that are our first attempt at organizing information. It's not wrong - just imprecise af.

    Anyway, hardlinks are a small step up, can build wild static structures (like a oneshot filesystem in Guix), but is cumbersome to control in multi-dimensional information structures. Likely not what you want, but look into fuse file systems if you want to move on to a dynamic file system hierarchy. An interesting one is a tag file system. It turns a standard limited hierarchy into a much more dynamic file-structure where a file can - and does - belong to a bunch of tags - file type, size, group, comments, whatnot. There are many many fuse fs that can convert anything into a better structured file system. Tagging is a step up from a dumb 2D hierarchy, but maybe a graph file system is the ultimate freeform dynamic filesystem that can present all the pov's we could possible need ?

    Go for it.

  • You may like gobolinux more, if a different file system hierarchy is your priority.

31 comments