Multiple file copy from 1 folder to another

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Kpochmx
Posts: 2
Joined: 07 Feb 2023 22:57

Multiple file copy from 1 folder to another

Post by Kpochmx »

Hello
i've be lurking forums trying to find a new user easy way to copy multiple files from a folder to another (99.99% of the time is a JPG) based on a list
i work as editor for a company that send me via in-house software around of 300 JPEG files per project and i need to review and select them.
so i need to copy files using Live Filter view 1 by 1 from the XYplorer window to a folder (simply drag and drop) but is a bit complicated over the course of the day.

files are names FILENAME1_AA_BB.jpg a single file can have multiple combination for example:

FILENAME1_AA_BB
FILENAME1_AA_CC
FILENAME1_BB_DD

FILENAME2_AA_BB_CC
FILENAME2_DD_AA


So i make a list in excel and simply copy/paste to live view filter and select 1,2 or 3 available pictures and D&D to another folder
is there a way to load a txt file containing a list of pictures and copy all of them to another folder

Example:
FILENAME1***
FILENAME2***
FILENAME3***
FILENAME4***
FILENAME5***

no matter if they end in AB BB DD etc, just the UniqueID name.

Thanks

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Multiple file copy from 1 folder to another

Post by highend »

Create a user defined command that executes a script and assign it a keyboard shortcut.

Store the unique file names in a file called "files.txt" (you can configure the name of it in the script) in the same folder where your files to copy are.

Execute the script while you are in the folder of the "files.txt" file, all belonging files will be selected so you can drag and drop them afterwards...

Code: Select all

    $fileNameToLoad = "files.txt"; // Must be in the same folder as the files you want to copy

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================

    $srcFile = <curpath> . "\" . $fileNameToLoad;
    end (exists($srcFile) != 1), quote($srcFile) . " not found, aborted!";

    $content = formatlist(readfile($srcFile, 3:=65001), "sed", <crlf>);
    end (!$content), quote($srcFile) . " is empty, aborted!";
    $files = listfolder(, , 1+4, <crlf>);

    $select = "";
    foreach($entry, $content, <crlf>, "e") {
        $esc = regexreplace($entry, "([\\^$.+()\[{])", "\$1") . ".*?(?=\r?\n|$)";
        $matches = regexmatches($files, $esc, <crlf>);
        if ($matches) { $select .= $matches . <crlf>; }
    }
    end (!$select), "No file(s) to select found, aborted!";
    selectitems $select;
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Multiple file copy from 1 folder to another

Post by admin »

The next beta comes with an enhanced version of Edit | Select | Select Items.... It will then support wildcards, so you can pass your list like this and select all matching items in one go:

Code: Select all

FILENAME1*
FILENAME2*
FILENAME3*
FILENAME4*
FILENAME5*
Then it's just another click to copy them to your target folder.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Multiple file copy from 1 folder to another

Post by admin »

highend wrote: 07 Feb 2023 23:36

Code: Select all

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================
Oh, what a useful addition to my text snippet library. :)

Kpochmx
Posts: 2
Joined: 07 Feb 2023 22:57

Re: Multiple file copy from 1 folder to another

Post by Kpochmx »

This works perfectly! :tup:

Also sent PP tip
highend wrote: 07 Feb 2023 23:36 Create a user defined command that executes a script and assign it a keyboard shortcut.

Store the unique file names in a file called "files.txt" (you can configure the name of it in the script) in the same folder where your files to copy are.

Execute the script while you are in the folder of the "files.txt" file, all belonging files will be selected so you can drag and drop them afterwards...

Code: Select all

    $fileNameToLoad = "files.txt"; // Must be in the same folder as the files you want to copy

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================

    $srcFile = <curpath> . "\" . $fileNameToLoad;
    end (exists($srcFile) != 1), quote($srcFile) . " not found, aborted!";

    $content = formatlist(readfile($srcFile, 3:=65001), "sed", <crlf>);
    end (!$content), quote($srcFile) . " is empty, aborted!";
    $files = listfolder(, , 1+4, <crlf>);

    $select = "";
    foreach($entry, $content, <crlf>, "e") {
        $esc = regexreplace($entry, "([\\^$.+()\[{])", "\$1") . ".*?(?=\r?\n|$)";
        $matches = regexmatches($files, $esc, <crlf>);
        if ($matches) { $select .= $matches . <crlf>; }
    }
    end (!$select), "No file(s) to select found, aborted!";
    selectitems $select;

Post Reply