I came up with this (see below) but It's still not working. It copies more than I intended it to. For example, If I have two files names in a list, It will copy 30 files with similar names.
I only want to copy exact names.
For example, if my list of file names within the txt file contains...
Redhouse.jpg
Redcar.jpg
RedBird.jpg
The code below will copy everything that starts with "Red". And the result will be....
Redhouse.jpg
Redcar.jpg
RedBird.jpg
RedCat.jpg
redplant.jpg
Note: I did not want RedCat.jpg or redplant.jpg to be copied.
How can i only copy the files in the list?
Here are the folder locations.
%ListFileLocation% = .txt file of file names
%SearchLocation% = Folder to search within for the file names
%Destination% = Folder where to paste the files
Question: how can I copy the files that exactly match the list?
Code: Select all
loop, Read, %ListFileLocation%
{
Find_it:=A_loopReadLine
Loop,%SearchLocation%\*.*
{
IfInString, A_LoopFileName, %Find_It%
FileCopy, %A_LoopFileFullPath%,%Destination%\%A_LoopFileName%
}
}
return