5 ms·
Good ideas, but there are a few things wrong with this. First, we forget that filesystems are not hierarchies, they are graphs, whether DAG's or not. [1] Seco
by gavinhoward 5y ago
Good ideas, but there are a few things wrong with this.
First, we forget that filesystems are not hierarchies, they are graphs, whether DAG's or not. [1]
Second, and this follows from the first, both tags and hierarchy are possible with filesystems as they currently are.
Here's how you do it:
1. Organize your files in the hierarchy you want them in.
2. Create a directory in a well-known place called `tags/` or whatever you want.
3. For every tag `<name>`, create a directory `tags/<name>/`
4. Hard-link all files you want to tag under each tag directory that apply.
5. For extra credit, create a soft link pointing to the same file, but with a well-known name.
This allows you to use the standard filesystem tools to get all files under a specific tag. For example,
find tags/<name> -type f
(The find on my machine does not follow symbolic links and does not print them if you use the above command.)
If you want to find where the file is actually under the hierarchy, use
find -L tags/ -xtype l
Having both hard and soft links means that 1) you cannot lose the actual file if it's moved in the hierarchy (the hard link will always refer to it), and 2) you can either find the file in the hierarchy from the tag or you know that the file has been moved in the hierarchy.
Of course, I'm no filesystem expert, so I probably got a few things wrong. I welcome smarter people to tell me how I am wrong.
[1]: https://lobste.rs/s/ydno8w/tree_structure_file_systems#c_njgkbj https://lobste.rs/s/ydno8w/tree_structure_file_systems#c_njg...
- jeddy3 5y ago> 2. Create a directory in a well-known place called `tags/` or whatever you want. > 3. For every tag `<name>`, create a directory `tags/<name>/` > 4. Hard-link all files you want to tag under each tag directory that apply. Does this only give you one level of tags? (i.e you can't combine tags when exploring)
- ghoward 5y agoIt does, unfortunately. But you probably could implement finding something with two tags with some command-line fu. My first crack at it is this: find -L tags/tag1 tags/tag2 -xtype l | sort | uniq -d I don't know if that would work (on mobile; can't test), but from reading the man pages, it seems like it would do the trick.
- ghoward 5y agoReplying again to give you a command that I've tested: find -L tags/tag1 tags/tag2 -xtype l | xargs readlink -f | sort | uniq -d
- ajnin 5y agoWith this you can't easily search for files that have multiple tags, the whole point of tags is that you can use them to find set intersections.
- gavinhoward 5y agoSee the comment I made to the sibling comment. For a tl;dr, you can use the following to find files that have more than one tag: find -L tags/tag1 tags/tag2 -xtype l | sort | uniq -d The lesson here is that being able to use command-line tools makes up for perceived limitations of the filesystem model. Edit: After testing, I found the following works great: find -L tags/tag1 tags/tag2 -xtype l | xargs readlink -f | sort | uniq -d
- dredmorbius 5y agoThe inability to define multi-tag searches (intersections) on Pocket is ... one of many gripes I have with that so-called tool. Article roach motel is more like it. Though the roaches can escape via bitrot, and often do.
- mr_toad 5y agoYou forgot step 6. Convince everyone (and everything) else who has write access to the file system to follow suit.
- ghoward 5y agoFair enough, although in my mind, I only care about tagging for my own files.