I have a master file (File1.txt
) where some names are maintained in the contents. I have to find all the files which has those kind of names (wild cards) in a folder and move them to a different folder using batch file program.
Eg : File1.txt
has contents
abcd
efgh
now in the folder say c:\temp\Source
i have files like
12abcd34.asc
56efgh78.asc
testing.asc
I have to move only those 2 files to a folder say c:\temp\Target.
Here's my code, but it gives error saying i*.* is unexpected at this time. Can you please help .
@Echo Off
title Test move files
set dir1=C:\temp\Source
dir %dir1%
Echo Directory Changed
FOR /f "eol=; delims=, " %i in (file1.txt) do move /y "*%i*.*" Target
Here you go....
This is what the directory structure is when I start...
This is the run.bat that I will run later .. includes the bug fixes...
Now I run the batch file ...
Now this is the final directory structure ... so you can see that it is working ...
Here is the for loop you need...
Changes:
Hope this helps.