Click here for important information about

Batch File to Search and Copy Results

Microsoft Windows xp professional w/serv...
June 1, 2010 at 08:43:29
Specs: Windows XP

I want to be able to do a search within a directory and then copy the results into both
1) A text file
2) Copy the found files into a new directory

So far this is what I have:

SET /p SEARCHTERM=Enter the Search Term:
SET /p DATEINPUT=Enter the Date (Ex: 2010-05-27)
cd "C:\TotalListOfTerms"



This part works ok, but I want the batch file to also copy the *found* files into C:\ByDate\%DATEINPUT%\

Any help is appreciated!

See More: Batch File to Search and Copy Results

June 1, 2010 at 21:21:18
for /f "tokens=*" FINDSTR /m /i "%SEARCHTERM%" *.* do (
echo "%%a" >"C:\ByDate\%DATEINPUT%\%SEARCHTERM%.txt"
copy "%%a" "C:\ByDate\%DATEINPUT%
::----end ; not tested!

Report •

June 2, 2010 at 06:13:59
Thanks for the reply! The code you sent looks pretty similar to what I found and works great.

Report •
Related Solutions

Ask Question