Search© file containing specifc text to a certain path (on a daily basis)
I am searching the sub folders of the following path P:\Gent\IntIn\#2012\06\28
(P:\Gent\IntIn\#2012\06\>findstr /s /m "SDT=:034273901" *.* )
I am using the command findstr /s /m "SDT=:034273901" *.*
and it returns the name of the file (IN_file__6789101.txt)
How do I copy that file and it's contents to the P:\Gent\IntIn\#2012\06\28
I also tried
findstr /s /p "sdt=:03427391" *.* > fileP.txt
the fileP.txt file has exactly what I want except that the file name is populated in the first few postions of the FileP.txt.
The files name will not always be the same lenght so I am not sure if removing text from the strart of the file is an option
Any suggestion would be greatly appreciated
Search© file containing specifc text to a certain path
Moderator: DosItHelp
Re: Search© file containing specifc text to a certain pa
This should work (untested)
Code: Select all
@echo off
pushd "P:\Gent\IntIn\#2012\06\28"
for /f "delims=" %%a in ('findstr /s /m "SDT=:034273901" *.*') do (
echo copying %%a
copy /b "%%a" .
)
popd
Re: Search© file containing specifc text to a certain pa
Thanks Foxidrive. That worked perfectly.
Much appreciated
Much appreciated