Move selected file(s) to the currently highlighted folder in other pane

Discuss and share scripts and script files...
Post Reply
juswannalearn
Posts: 4
Joined: 06 May 2022 19:13

Move selected file(s) to the currently highlighted folder in other pane

Post by juswannalearn »

Is this possible with a script?

I have lots of files I want to organise into existing subfolders, but I don't wish to navigate into and out of each subfolder in the opposite pane during each move operation.

I want to simply highlight the folder in the opposite pane that I want to move files to (without opening it), and move the highlighted files into it on a command. Ideally with a custom shortcut key.

As an additional enhancement - if multiple folders are selected/highlighted, then move the selected files to each (i.e. creating copies as required).

Many thanks for your help in advance!

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move selected file(s) to the currently highlighted folder in other pane

Post by highend »

Code: Select all

    foreach($folder, <get SelectedItemsPathNames <crlf> i>, <crlf>, "e") {
        if (exists($folder) == 2) { copyto $folder, 4:=2, 11:=0; }
    }
One of my scripts helped you out? Please donate via Paypal

juswannalearn
Posts: 4
Joined: 06 May 2022 19:13

Re: Move selected file(s) to the currently highlighted folder in other pane

Post by juswannalearn »

Wow thank you that's amazing! Much appreciated.

juswannalearn
Posts: 4
Joined: 06 May 2022 19:13

Re: Move selected file(s) to the currently highlighted folder in other pane

Post by juswannalearn »

Is there a way to adapt this so that if a single folder is selected, files are MOVED rather than copied into that location?

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move selected file(s) to the currently highlighted folder in other pane

Post by highend »

Code: Select all

    $dstFolders = <get SelectedItemsPathNames <crlf> i>;
    if (gettoken($dstFolders, "count", <crlf>) == 1) {
        if (exists($dstFolders) == 2) { moveto $dstFolders, 4:=2, 11:=0; }
    } else {
        foreach($folder, $dstFolders, <crlf>, "e") {
            if (exists($folder) == 2) { copyto $folder, 4:=2, 11:=0; }
        }
    }
?
One of my scripts helped you out? Please donate via Paypal

juswannalearn
Posts: 4
Joined: 06 May 2022 19:13

Re: Move selected file(s) to the currently highlighted folder in other pane

Post by juswannalearn »

Amazing, thank you, I will test it out over the weekend.

Post Reply