i would like to know if, via a script, it could be possible to put a limitation for going up to a specific parent folder, as like as X:\
-> would be useful sometimes to limitate unwanted multiple clicks on Up parent folder icon or multiple backpace key actions
limitating parent folder upping to a drive root ?
Re: limitating parent folder upping to a drive root ?
Create a user defined command which runs this script:
Change the $maxRootLvl variable to either
0, 1, 2, ...
E.g.:
Local path: C:\Users\%USERNAME%\AppData\Roaming
0 would limit it to: C:\
1: C:\Users
2: C:\Users\%USERNAME%
etc.
Same for network paths
Network path: \\server\dlna\movies
0 would limit it to: \\server
1: \\server\dlna
2: \\server\dlna\movies
etc.
Remove backspace from the keyboard shortcut for the "Go - Up" command
and bind it to the user defined command
Additionally, add a new user button to the toolbar and use the id of that user defined command
in the "On left click field"
The icon could e.g. be: ":up" (without the double quotes)
Code: Select all
$maxRootLvl = 2;
$upLvl = regexreplace(<curpath>, "\\[^\\]+$") . "\";
$cntSep = gettoken($upLvl, "count", "\") - 1;
// Local paths
if (substr(<curpath>, 0, 2) != "\\") {
$distance = $maxRootLvl + 1;
// Network paths
} else {
$distance = $maxRootLvl + 3;
}
if ($cntSep < $distance) { end true; }
goto $upLvl;
0, 1, 2, ...
E.g.:
Local path: C:\Users\%USERNAME%\AppData\Roaming
0 would limit it to: C:\
1: C:\Users
2: C:\Users\%USERNAME%
etc.
Same for network paths
Network path: \\server\dlna\movies
0 would limit it to: \\server
1: \\server\dlna
2: \\server\dlna\movies
etc.
Remove backspace from the keyboard shortcut for the "Go - Up" command
and bind it to the user defined command
Additionally, add a new user button to the toolbar and use the id of that user defined command
in the "On left click field"
The icon could e.g. be: ":up" (without the double quotes)
One of my scripts helped you out? Please donate via Paypal