Expand Folders is a script command for Directory Opus, which simplifies the expansion/collapse of entire branches in all or selected folders when using Expandable Folders feature in the current file display.
Its main features are:
- Expand all folders in the current file display to their maximum depth (all levels).
- Expand only selected folders.
- Expand only top level folders.
- Expand all/selected up to the desired level.
- Collapse all/selected expanded folders.
- Smart choice for decide between expand or collapse.
- Optionally when expanding folders, select files/folders within.
How To Install
Download the file below. Then run Prefs SCRIPTINSTALL
and select the downloaded file.
IMPORTANT: Needs at least v13.5.1
v1.6.0 : ExpandFolders.opusscriptinstall
Usage
You can use Expand Folders as a command, using ExpandFolders
.
When used this way, it will expand the selected folders to their maximum depth. If no folders are selected, all folders in the current file display are used.
In addition, the command has the following arguments:
COMMAND ARGUMENTS
Argument | Type | Values | Description |
---|---|---|---|
ALL | /S | (no value) | Use all folders in the current file display. If not especified, when there's no items selected, `ALL` will be implicit. |
COLLAPSE | /O | (no value) | Collapse folders if they are expanded. Can be used in conjunction with ALL. When used alone, selecting files will collapse the parent folder above. If folders are selected, they will be collapsed, if possible. |
parent | Use COLLAPSE=parent to change the difference between files and folders, and selecting subfolders will collapse their parent folders. | ||
EXPAND | /O | (no value) | This argument will be the default unless COLLAPSE or TOGGLE are present. Use it to expand all or only selected folders. |
int | Where int is a integer referring to a level. Use EXPAND=int (eg. EXPAND=2) to expand till the desired level. | ||
top | Use EXPAND=top to only expand the first level. | ||
SELECT | /O | (no value) | Select all items beneath folders expanded by this command. |
dirs | Select dirs only, excluding the files. | ||
TOGGLE | /O | (no value) | Toggle between the two states, based on the expanded condition for the selected items (or all if nothing selected or ALL is used). |
expandtop | Use TOGGLE=expandtop to only expand the first level, if TOGGLE follows that direction. | ||
colparent | Use TOGGLE=colparent to enable parent argument when collapsing, if TOGGLE follows that direction. | ||
int | Use TOGGLE=int to refer the number of levels to expand, if TOGGLE follows that direction. |
Examples
Expand all/selected folders in current file display
ExpandFolders
or ExpandFolders EXPAND
Expand Folders.dcf (345 Bytes)
Expand all folders in current file display
ExpandFolders EXPAND ALL
Expand all folders to first level in current file display
ExpandFolders EXPAND=top ALL
Collapse all expanded folders in current file display
ExpandFolders COLLAPSE ALL
Collapse All Folders.dcf (343 Bytes)
Toggle expanded state for all/selected items
ExpandFolders TOGGLE
Toggle expanded state for all/selected items. If expanded, expand up to 3 levels and select only folders within
ExpandFolders TOGGLE=3 SELECT=dirs
Expand selected folders (or all if nothing selected) only the top level.
Use it in conjunction with Shift for expand at max depth.
Also, use it in conjunction with Ctrl for select items beneath expanded folders.
=return "ExpandFolders EXPAND" + (KeyDown("shift") ? "" : "=top") + (KeyDown("ctrl") ? " SELECT" : "");
Expand All_Selected.dcf (563 Bytes)
Know Issues
- When expanding a branch for the first time, there may be a delay because DOpus needs to read new item's info.
Changelog
v1.6.0 (Apr 21, 2024): ExpandFolders.opusscriptinstall (5.8 KB)
- Now the dialog use font name/size configured in Preferences / Colors and Fonts / Fonts > Dialogs.
SELECT
can be used in Libraries.- Better logging system.
- Minor improvements.
Full changelog
v1.5.1 (Mar 09, 2024):
- Added in Script Config a new value : Expanding Dialog Delay, allows you to set the delay time before showing the expanding dialog (useful for shorter expansions). Default is 1 second (1000).
- Minor changes.
v1.5.0 (Mar 01, 2024):
- Improved overall logic when expanding/collapsing.
- New int value for
EXPAND
andTOGGLE
, to refer to an specific level when expanding. levels
andcollevels
values have been removed fromCOLLAPSE
andTOGGLE
respectively. Now the command respect the option in Preferences / File Displays / Folder Expansion : Collapse sub-folders within collapsed folders.- Added in Script Config a new value : Max Timeout when Expanding, to customize the maximum time in milliseconds that the command will wait after each level expansion to abort the entire command. By default is 15 seconds (15000).
v1.4.0 (Feb 28, 20024);
- Internal build.
v1.3.0 (Feb 22, 2024):
COLLAPSE
has a new value :levels
, to effectively collapse all the expanded folders in all levels.- Added
colparent
andcollevels
values forTOGGLE
, to enable the corresponding values for collapse. - A problem with the custom progress dialog that interfered with other listers/windows, minimizing/bringing them to the front, has been fixed.
v1.2.1 (Feb 11, 2024):
- Now when expanding only the top level, is no longer initialized a new thread.
- Added
SELECT
andSELECT=dirs
, which allows to select the files/dirs beneath the new expanded folders by the command.
v1.1.0 (Feb 02, 2024):
- Added new argument:
TOGGLE
andTOGGLE=expandtop
, for toggle between two states - New custom progress dialog when expanding.
v1.0.1 (Jan 24, 2024):
- Added new argument:
EXPAND
and the subvalueEXPAND=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.
v1.0.0 (Jan 23, 2024) Initial release