I want to use metadata views to sort files into top-level directories based on a tag, but then preserve the directory structure underneath that. I'm having trouble with this.
Say I have an annex at ~/annex with a structure like this:
$ tree
.
├── foo
│ └── bar
│ ├── one.txt
│ ├── three.txt
│ └── two.txt
└── waldo
└── fred
├── a.txt
├── b.txt
└── c.txt
I tag some of the files with blah:
$ git annex metadata -t blah foo/bar/*
Now I want to change my view to only see those files with a certain tag, but I want to maintain their directory structure, ie I want to end up with something like this:
$ tree
.
├── blah
│ └── foo
│ └── bar
│ ├── one.txt
│ ├── three.txt
│ └── two.txt
If I do git annex view blah I see the files one.txt, two.txt and three.txt but they are in the top level of ~/annex. The foo and bar directories are not present.
If I do git annex view blah "/=*" then the files I present under the foo directory, but the bar subdirectory is not there.
It would also be fine if I could just hide the files that did not have the blah tag, so that I ended up with this:
$ tree
.
├── foo
│ └── bar
│ ├── one.txt
│ ├── three.txt
│ └── two.txt
Is something like this possible?

This behavior needs to be the default. Though, I understand that everyone have different needs.
At least it may be better to configure the behavior via a command argument, e.g. by default
git annex viewpreserves the directory structure.And when
--plainargument is provided, then it would behave as it currently does - the directory structure is not preserved.Personally, I do not see any use cases for the active behavior because usually I set tags to many files (thousands), and it's not practical for me to see thousand files in a single directory (view tag). As a more real-world example - I've tried to prepare files to be burned into BDXL disk, and for that purpose I tagged the files I want to burn as
bdxl-disk-1tag. I then usedncduto analyze the space taken by that tag. But then when I started "fine tuning" what should and should not go to that disk, I found it too difficult becausegit annex viewplaces all tagged files into a single directory.Are there any workarounds? I'm using git annex version
10.20231228.Seems like there is a way to use git annex as I would like, though it may not be obvious.
In order to organize files and then burn them on to BDXL, instead of using tags, I've just switched to a new branch. e.g.:
and then moved files and folders to a new folder which I intend to burn later. I've also assigned
git annex tag bdxl-disk-1 . --forcedirectly in this folder, so later I can see which files are burned even on the main branch (because tags are tied to git annex content and shared across branches).P.S.: In any case, preserving the folder structure on the first
git annex view tag=*may be much more powerful and intuitive.