Page 1 of 1
Keep position after move to subfolder
Posted: 12 Aug 2020 14:17
by reebae
Hello,
I am using "File | Duplicate | Move Here to New Subfolder..." for a lot of files, sometimes hundreds in one folder. This works well, but when I select a few files and choose this option (using a user button), I lose my place among the hundreds of files because the focus jumps to the newly created folder, always at/near the top of the list. Is there a way I can use this function but keep my place in the file list each time?
Thank you
Re: Keep position after move to subfolder
Posted: 12 Aug 2020 14:32
by highend
You could. By adding additional script lines (get the file before the first selected, ID of the command, select that file, scroll it into view).
But before doing that, copying the way it works as a script seems a lot easier...
Code: Select all
$items = <get SelectedItemsNames <crlf>>;
end (!$items), "No item(s) selected, aborted!";
$fstItem = gettoken($items, 1, <crlf>);
$fldName = input("Move Here to New Subfolder", "Select or enter folder name or subpath.", gpc($fstItem, "base"));
end (trim($fldName) == ""), "No subfolder name given, aborted!";
moveto "<curpath>\$fldName", $items, , 2, 2;
Re: Keep position after move to subfolder
Posted: 12 Aug 2020 15:52
by reebae
Thank you very much. This script works well.
I notice one difference between this and the #1041 command -- it doesn't prompt me upon subfolder name collisions (Subfolder 'xyz' already exists). Honestly, it saves me a click/time so it's not a bad thing, but is there an option to check for an existing folder of the same name? I'm willing to create another button that gives this prompt if necessary (as opposed to a submenu prompt). Sometimes I need to be careful and not create many unnecessary folders with slightly different names, so prompts are helpful.
Re: Keep position after move to subfolder
Posted: 12 Aug 2020 16:08
by highend
Code: Select all
$items = <get SelectedItemsNames <crlf>>;
end (!$items), "No item(s) selected, aborted!";
$fstBase = gpc(gettoken($items, 1, <crlf>), "base");
$fldName = input("Move Here to New Subfolder", "Select or enter folder name or subpath.", $fstBase);
end (trim($fldName) == ""), "No subfolder name given, aborted!";
$dstPath = "<curpath>\$fldName";
if (exists($dstPath) == 2) {
if (confirm("Subfolder '" . $fldName . "' already exists.<br><br>Do you still want to move the selected items here?")) {
moveto $dstPath, $items, , 2, 2;
}
} else {
moveto $dstPath, $items, , 2, 2;
}
Re: Keep position after move to subfolder
Posted: 12 Aug 2020 17:38
by reebae
This is exactly what I needed. Thank you for the script and your help.