Important note: I do NOT want to collapse all folders at once using ALT+ left arrow.
Let's say I have 10 Finder folders and each folder contains multiple sub folders, like this:
Folder (root) > Sub1 > Sub 2 > Sub 3
When I select all main folders and hit Right Arrow, it expands all folders, now showing me Sub1 folders as well. Then if I hit CMD+A and hit Right Arrow again, it expands all visible folders (sub1), etc. So I can do this until all my root folders and sub folders are expanded.
Now what if I just want to collapse all visible sub folders 3 and leave all the other folders visible? Is this possible? In this case I would collapsing all Sub3:
Remember that I have 10 root folders, so my goal is to do this automatically without clicking the triangle on all 10 sub3 folders.
Then when all sub 3 are collapsed, I could do the same for all 10 sub2, etc.
Why do I need this? Sometimes I want to confirm the content on sub/sub/sub folders and I want everything to be visible all the way up to the root folders. And when I'm done checking the lowest hierarchy folder, I would like to just hit a shortcut and it collapse all sub3, then I could focus on checking all sub2 folders, etc
Manually, if they are all in one window -- easy. ⌘-Click each subfolder you want to close then ⌘←
Automagically, this is going to be tricky (to say the least!). For as long as there have been expandable folders, Finder's AppleScript dictionary has said expanded (boolean) : (NOT AVAILABLE YET) -- that route's out.
Is that 10 folders being viewed in one Finder window, or one root folder in each of 10 Finder windows?
Why do you need this What are you checking for? It may be there's a better way, which doesn't depend on fallible eyeballs, or perhaps there's some previous part of your workflow that could be refactored to prevent "whatever" from happening in the first place.
My goal is to close all sub folders based on their hierarchy.
So first it would close all Sub 3 inside all Sub 2.
Let's say this is with all of them open/visible/expanded:
Root folder 1 > Sub 1 > Sub 2 > Sub 3
Root folder 2 > Sub 1 > Sub 2 > Sub 3
Root folder 3 > Sub 1 > Sub 2 > Sub 3
Root folder 4 > Sub 1 > Sub 2 > Sub 3
Root folder 5 > Sub 1 > Sub 2 > Sub 3
Now I press CMD+A to select everything and when I press the shortcut I get this:
Root folder 1 > Sub 1 > Sub 2
Root folder 2 > Sub 1 > Sub 2
Root folder 3 > Sub 1 > Sub 2
Root folder 4 > Sub 1 > Sub 2
Root folder 5 > Sub 1 > Sub 2
(meaning all Sub 3 folder inside all Sub 2 folder would be now closed/collapsed).
Check my reply to Neil above.
If I'm on Desktop, for example, I will see 10 folders. Inside each one of those 10 folders I will have 1 folder, with a folder inside, with a folder inside:
Root > Sub 1 > Sub 2 > Sub 3 (this x10 folders)
It's not always the same scenario, but I see myself wishing this over and over again.
I'm very methodical with my work so I like to so things in series. For example maybe I want to check if all Sub 3 folders have a file with the name "File001" without opening and closing folders over and over again. I can just open everything, go through everything by just scrolling and when I'm done, I can collapse just the Sub 3 folders all together. Check Sub 2 folders, etc.
To be honest, for my workflow, there is no other way, just because that's how I like working. Visually. It probably doesn't work for everybody, but it does for me and if this isn't possible with KM, then I will have to live with it
If the first it will probably be both quicker and easier to do this manually -- you can't with the second because you can't create a non-contiguous selection across windows.
Doing it with KM, the only way I can think of right now (since scripting is out) is to start at the bottom of the window and work up until you have a matching name -- or rather a matching path under your root folders -- to the selection and ⌘← that matching item. In scenario 1 you'll have to keep going up the window until you reach the top, in scenario 2 you'd stop on first match then repeat for all the other windows. Either way is a lot of flashy-blinky screen action...
There's always another way, though it may not be better or suited to the way you work. In this case I'd start with "Why do you need to check?". If something's getting out of whack, can you solve at that point rather than this? If these folders are supposed to be the same, can you not have a "single source of truth" and sync from that? If these are projects that always have the same initial structure, can you clone from a template? Etc, etc.