Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I am new to windows scripting. Pardon me and forward me to right URL if this has been posted before. I tried but was not ale to find the required one.
Here it goes.
i have iis logs generated in three servers with file name as exyymmdd.log. for generating acccess report using logParser for certain days like between 1st january to 7th january my input to the batch will be asanalyselogs.bat 070101 070107
Now i need to copy the sevendays file to the local server under the names as server1_070101 ....070107
server2_070101 ....070107
server3_070101 ....070107How do i do it? Please suggest
Thanks and Best regards
Carl
Carl Lewis Sajjan

Thing i think i need to make clearer is i need to add copying the files part of script into the batch script i am giving input to.
Carl Lewis Sajjan

Try this:
::== 8.bat
@echo off
setLocal EnableDelayedExpansionif %2'==' echo need Start and End date && goto :eof
set S=%1
set E=%2for /f "tokens=* delims= " %%A in ('dir /on/b x\*.log') do (
set C=%%~nA
if !C! geq !S! , if !C! leq !E! echo copy %%A server1_%%A
)
:: DONE
=====================================
If at first you don't succeed, you're about average.M2

Thanks Mechanix2Go I figured it out cause of your help.My working code looks like this....
-------------
@echo off
setLocal EnableDelayedExpansionif %2'==' echo need Start and End date && goto :eof
set S=%1
set E=%2for /f "tokens=* delims= " %%A in ('dir /b E:\*.log ') do (
set C=%%~nA
set Q=!C:~7,6!
if !Q! geq !S! , if !Q! leq !E! copy %%A server1_!Q!.log
)------
Carl Lewis Sajjan

Cool; glad you made it work.
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

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