How to find files from a list and copy them to another folder ?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
MarvinStraight
Junior Member
Junior Member
Posts: 3
Joined: 2024-07-04, 10:17 UTC

How to find files from a list and copy them to another folder ?

Post by *MarvinStraight »

Is this kind of advanced search possible?


I have a text file with 19000 lines. Each line is a different string of unique numbers (i.e. 9842314826, 28247939115 etc.).

I want to find files in a folder that contain those strings in their names. All the files have names like this: 21857250156_f1db18c723_6k.jpg, 48707031463_3416a0acd8_o.jpg etc.

Some of those will match, but most won't. When that's done, I want to copy all those files to another folder (feeding to listbox would suffice, I guess).

So far I tried Total Commander and Everything (voidtools), but I can't find a way to accomplish this task using those. Can somebody help me out?
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How to find files from a list and copy them to another folder ?

Post by *white »

  1. Use an capable editor to edit the text file and replace each line with *<number>*.
  2. Use the LOADLIST command to load your text file
MarvinStraight
Junior Member
Junior Member
Posts: 3
Joined: 2024-07-04, 10:17 UTC

Re: How to find files from a list and copy them to another folder ?

Post by *MarvinStraight »

white wrote: 2024-07-04, 11:38 UTC
  1. Use an capable editor to edit the text file and replace each line with *<number>*.
  2. Use the LOADLIST command to load your text file
I did step 1 using RegEx and now every line looks like this: *<9842339874>*

I don't know how to use LOADLIST, though. I made a button on the button bar with LOADLIST as command, full path to file as parameters and path to file (sans filename) as start path. When I use the button, it says "File not found! (19000x).

Keep in my mind that only the first part of the filename (before the first underscore) is supposed to match the numbers from the text file.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6950
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: How to find files from a list and copy them to another folder ?

Post by *Horst.Epp »

You have to use LOADLIST0
From the help:
LOADLIST0: Like LOADLIST, but do not show any error messages if files cannot be found.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How to find files from a list and copy them to another folder ?

Post by *white »

MarvinStraight wrote: 2024-07-05, 07:14 UTC I did step 1 using RegEx and now every line looks like this: *<9842339874>*
You should have replaced "<number>" with your numbers. So remove the "<" and ">".
MarvinStraight wrote: 2024-07-05, 07:14 UTC I don't know how to use LOADLIST, though. I made a button on the button bar with LOADLIST as command, full path to file as parameters and path to file (sans filename) as start path. When I use the button, it says "File not found! (19000x).
LOADLIST has only 1 parameter, the filename of the list file. The start path will be the location of the list file.
MarvinStraight wrote: 2024-07-05, 07:14 UTC Keep in my mind that only the first part of the filename (before the first underscore) is supposed to match the numbers from the text file.
Adjust the expressions in the list file to match what you want. For example to match the number at the beginning of a filename directly followed by an underscore, use:

Code: Select all

9842339874_*
MarvinStraight
Junior Member
Junior Member
Posts: 3
Joined: 2024-07-04, 10:17 UTC

Re: How to find files from a list and copy them to another folder ?

Post by *MarvinStraight »

white wrote: 2024-07-05, 09:26 UTC ...
It worked. Thanks!
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Re: How to find files from a list and copy them to another folder ?

Post by *Phred »

LOADLIST has only 1 parameter, the filename of the list file. The start path will be the location of the list file.
I too am trying to understand the LOADLIST feature and its companion SAVESELECTION.
They seem to be particularly rigid commands with absolute parameters demanded, that is to say:
SAVESELECTION C:\Users\Public\Documents\SaveselectionLoadlist.txt
..as an essentially unchangeable setting for both saving and loading.

The Help file for setting up a button-bar button says:
17. SAVESELECTION, SAVESELECTIONA, SAVESELECTIONW: save names of selected files to the specified file.

Note:- "..the specified file".

Am I right in thinking that this rigidity of configuration is correct and in fact extremely rare in computing ?
It reminds me of recent reports of usernames & passwords written in hardware in some communications devices, or firmware containing the words "These settings are examples. DO NOT USE THESE CODES!" - inside IT gear actually sold on the commercial market.
Regards, PhredE
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to find files from a list and copy them to another folder ?

Post by *ghisler(Author) »

???
The user specifies the file name to which the list is saved, it's not hard coded.
Author of Total Commander
https://www.ghisler.com
Post Reply