Open SeanPedersen opened 3 years ago
I had the same problem and solved it using find. It's a bit hacky but works:
$ find . -type f -exec sh -c 'tmsu tag "{}" $(dirname {} | tr -d "." | tr "/" " ")' \;
When ran in Wallpapers
this tags all files in art/escher
with "art" and "escher".
For "directory" grouping:
$ find . -mindepth 1 -type d -exec sh -c 'tmsu imply $(echo "{}" | tr -d "." | tr "/" "\n" | tac | tr "\n" " ")' \;
This creates an implication from every directory name to every parent directory name, until (and excluding) the current working directory. (So art/escher/tesselations/
would create tesselations => art; tesselations => escher; escher => art)
Cool that you managed to make it work using bash. In the mean time I have created my own tagging tool (https://github.com/SeanPedersen/HyperTag) which comes native with the import function.
The idea is to leverage existing directory hierarchies to automatically import tags for files contained in them.
I have an existing collection of art images, e.g.
Wallpapers/art/escher
,Wallpapers/art/munch
, etc. and I want to import them into my tag collection as tag groups like so:$ cd Wallpapers
$ tmsu tag import .
This should result in subdirs of art/ being grouped as art and files of escher/ and munch/ being tagged with their respective parent dir names. I hope it is clear what I mean, if not I am available for further discussion. This issue is related to #213 where the feature tag groups I refer here is discussed.