I need to get log files from 2 diff directories and copy them into same target directory based on some conditions on logfilenames. Logic of getting logs based on logfilenames is working fine and they are printed to console.
Below is the script:
@ECHO OFF
for /f "delims=" %%F in (
dir /b "C:\temp1\*web_feed*.out*.gz"^|findstr "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.) do if "%%F" geq "20130101" if "%%F" lss "20130931" echo %%F
for /f "delims=" %%F in ('dir /b "C:\temp2\*web_feed*.out*.gz"^|findstr "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.) do if "%%F" geq "20130101" if "%%F" lss "20130931" echo %%F
pause "Please enter any key to continue"
Now the above script brings log files from c:\temp1 and c:\temp2 based on date conditions and print to console using echo, but I want those log files to be copied to target directory. Where do I need to add the copy condition so that the logfiles obtained from c:\temp1 and c:\temp2 directory are copied into c:\temp3 directory?
Also can I accomplish the duplicate steps of coping log files from 2 different directories in single step, instead of 2 separate steps for separate directories.
I am novice to batch scripting, my script is not working when I add copy command.
*web_feed*.out*.gzfiles?