Expand Folders Command

hello, it's a nice script.
may be it would be useful to add this feature? (collapse on selected files or subfolders)
and may be this would be a little faster if you limit folder's depth as Leo says to 10 or similar.
thank you so much

I think that is quite feasible to implement. I'll take a look at it when I have free time. Thank you.

If I understand correctly what Leo suggests, that would only work to expand all folders, and with certain drawbacks as well:

  • Would the command end up running Go EXPANDBRANCH 10 times for any scenario, even when there's only 1 folder to expand? Or how would I know when to stop without consulting (updating) the tab data ?

Update v1.0.1:

  • Added new argument: EXPAND and the subvalue EXPAND=top to only expand the first level in folders.
  • Now when collapsing, you can select files to collapse their parent folder.
  • Added new subvalue COLLAPSE=parent, to collapse parents for selected folders as well.
3 Likes

Interesting work, as usual! And needed to round out Expandable Folders options.

As a beta tester, I think I found the following:

If I run ExpandFolders on any set of folders of depth 0 or 2, the folders are expanded. If I immediately run ExpandFolders COLLAPSE ALL (the originally selected folders are still selected) nothing at all happens. If I then deselect all items and run ExpandFolders COLLAPSE ALL, all the folders collapse.

If the set of folders includes at least one folder with a depth of 2, and I run ExpandFolders and then immediately run ExpandFolders COLLAPSE ALL, all the folders collapse.

Can you duplicate this?

Fixed. Thanks! Please download the new version now.

Sorry, I don't think I'm understanding corrrectly this one. If you run ExpandFolders COLLAPSE ALL, all the folders are going to be collapsed, despite the previous command.

1 Like

can i set just one hotkey with this script to expand and collapse (if there is expanded but nothing selected) folders as in your beatiful code from here

Thanks so much for the quick fix. The second part is my long-wined way of saying that COLAPSE ALL worked of the folders of depth 2 or more. Thanks, again.

For what is worth, COLLAPSE ALL means collapse all visible folders in current file display, not only the one's who are nested behind a selected folder.

Since I had some more time today, I was playing a bit with this command to adapt it more to my needs. I have ended up extending it more than I expected :grin:
The v1.1.0b brings with:

  • TOGGLE to automatically switch between collapse or expand. Please note that if used with ALL, the command collapses folders if any expanded folder exists or expands otherwise. Without ALL, it checks only the selected folders (that is, it checks the set of folders as a whole).
  • Since there is a small freeze every time the tab data is updated, the breadcrumbs bar busy indicator implemented was unusable, so I replaced it with a dialog of its own. This means:
    • When expanding, the command run as a separate program (using dopusrt.exe), and intercommunicate with the dialog.
    • You have a better record that the command continues expanding (very useful for use with deep folder nests).
    • You can stop the expansion in a more user friendly way at any time.
    • Expansion runs slightly faster.

You can test it by downloading v1.1.0b from the main post. As usual, leave here your comments/suggestions/error findings. Beta testers always come in handy :smiley:

1 Like

Hello. DOpus hangs if i cancel script via new dialog.

Can you be more specific?
What was the full command line?
In what condition/scenario? In order to reproduce the issue.

i use ExpandFolders TOGGLE with no selected folders on my desktop folder. after 12-17sec i click "Cancel" and Dopus hangs - can't even select one file. But after 1.5-2min DO came back to life.

Out of curiosity, with how many files and folders do you end up when fully expand the desktop? You may try with Everything to quickly find out. Do you have links, softlinks, etc sitting in there?

41 folders of first level and 200k files at all)))
image

Probably DO dealing with calcs for every value in every column for all those files plus updating tab data was the cause for the freezing? :slight_smile: I don't recommend fully expansion in that conditions.

yes, of course, but canceling doesn't work anyway. maybe it's an Opus issue?
(and I didn't know how many files I had there, it came out by accident)

It does work, but the command queries the cancel status after each expanded level, so to speak. It doesn't cancel the current level calculation or the column calculations and so on. If you can check the total number of files in your desktop through Everything, there are probably more.
Perhaps doesn't hurt add some mechanisms to stop the process if the user falls into a long expansion by mistake...
@fkast does the freezing also happens if you turn on FLATVIEW in the desktop folder, in order to fully expand it?

nope. goes instantly

That's very odd to say the least :smile:.
I add some extra checks to avoid this kind of situations.
I do check trying to expand the whole Users folder and cancel after a while :smile:
Please note that when you cancel, there's still a small dead time, that's the tab updating their data.
Feel free to download v1.1.0 b2 in the main post to see how it goes now.
Thanks for your feedback btw.

yes, it's much better. now the wayting time is about 10-15sec after cancelling and there is a busy mouse arrow now))) [I'm not sure if it was there last time]