Sort folders on top except when sorted by "Modified"

I don't think this can be directly set in the settings (except in Folder Formats), but you could use a button that combines the two commands and/or have a Script Add-in do it after a folder change.

Set SORTBY=modified
Set SORTORDER=files

(See Raw Commands in How to use buttons and scripts from this forum)

// FoldersDownIfSortedByModified

// This is a script for Directory Opus.
// See https://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.

// Called by Directory Opus to initialize the script
function OnInit(initData) {
    initData.name = 'FoldersDownIfSortedByModified';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

// Called after a new folder is read in a tab
function OnAfterFolderChange(afterFolderChangeData) {
    var cmd = DOpus.Create.Command;
    cmd.SetSourceTab(afterFolderChangeData.tab);
    if (afterFolderChangeData.tab.format.sort_field == 'modified') {
        cmd.RunCommand('Set SORTORDER=files');
    } else {
        cmd.RunCommand('Set SORTORDER=folders');
    }
}

FoldersDownIfSortedByModified.js.txt (726 Bytes)

(Download, then drag the file to the list in Preferences / Toolbars / Scripts.)

1 Like