Close tabs when folder is deleted or moved

Is there an option to have tabs close when the folder that tab is attached to is deleted or moved? Normal behavior seems to be the tab is kicked to the directory above leaving me with alot of tabs i have to manually close after.

1 Like

Support++ for the OP's option to have a tab close when the folder the tab is attached to is deleted or moved.

Give this little script a try. It uses the OnBeforeFolderChange event to intercept the folder change and close the tab.

function OnInit(initData) {
    initData.name = 'TabCloseIfParent';
    initData.version = '2024-05-27';
    initData.url = 'https://resource.dopus.com/t/close-tabs-when-folder-is-deleted-or-moved/50957';
    initData.desc = 'Close Tab instead of going to parent folder';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnBeforeFolderChange(beforeFolderChange) {
    if (beforeFolderChange.action != 'parent') return;
    var cmd = DOpus.Create().Command();
    cmd.SetSourceTab(beforeFolderChange.tab);
    cmd.RunCommand('Go TABCLOSE');
}

Save EventTabCloseIfParent.js.txt to   ↓

%appdata%\GPSoftware\Directory Opus\Script AddIns

How to use buttons and scripts from this forum


There's already the Preferences / Folder Tabs / Options / Close tab on device ejection option, so adding something like Close tab on folder delete doesn't seem too far off.