Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have an output-list (master.txt) that consists of multiple lines. Each line contains a (part of a-) filename.
Example:
orderref_010134
orderref_010135
orderref_010139I want to use a batchfile to find any files from a directory and it's subdirectories that contain each of those lines.
Something like:
xcopy *orderref_010134* c:\collect /s /y
xcopy *orderref_010135* c:\collect /s /y
xcopy *orderref_010139* c:\collect /s /ySo I will end up with only the files that have these names in them.
I hope I'm clear with my question?
(I need to process such a list, hundreds of orderfiles each month. I'm doing that manually in Windows Explorer now by searching orderref_010134,orderref_010135,orderref_010139 which produces the result I need. If I could batch this action, I would use it to create a zip-file and email it automatically with blat to the person who needs those files)
Hi
Do you mean something like this.@echo off
cd Temp
dir /b /s | find "orderref_01134" > Files.txt
dir /b /s | find "orderref_01135" >> Files.txt
dir /b /s | find "orderref_01139" >> Files.txtfor /f %%a in (Files.txt) do copy %%a \Collect > nul
echo Done!
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |