Computing.Net > Forums > Windows Server 2003 > Batch script for copying files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch script for copying files

Reply to Message Icon

Name: sajjan27
Date: January 15, 2007 at 10:50:16 Pacific
OS: Windows 2003
CPU/Ram: 7 GB
Product: Sunv40Z
Comment:

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 as

analyselogs.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 ....070107

How do i do it? Please suggest

Thanks and Best regards
Carl


Carl Lewis Sajjan



Sponsored Link
Ads by Google

Response Number 1
Name: sajjan27
Date: January 15, 2007 at 10:52:15 Pacific
Reply:

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


0

Response Number 2
Name: Mechanix2Go
Date: January 16, 2007 at 14:12:49 Pacific
Reply:

Try this:

::== 8.bat
@echo off
setLocal EnableDelayedExpansion

if %2'==' echo need Start and End date && goto :eof
set S=%1
set E=%2

for /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



0

Response Number 3
Name: sajjan27
Date: January 19, 2007 at 08:34:07 Pacific
Reply:


Thanks Mechanix2Go I figured it out cause of your help.

My working code looks like this....
-------------
@echo off
setLocal EnableDelayedExpansion

if %2'==' echo need Start and End date && goto :eof
set S=%1
set E=%2

for /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


0

Response Number 4
Name: Mechanix2Go
Date: January 19, 2007 at 09:54:00 Pacific
Reply:

Cool; glad you made it work.


=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Windows Server 2003 Forum Home


Sponsored links

Ads by Google


Results for: Batch script for copying files

Batch script to move/delete files www.computing.net/answers/windows-2003/batch-script-to-movedelete-files/6453.html

FTP Batch Script for date filename www.computing.net/answers/windows-2003/ftp-batch-script-for-date-filename-/811.html

FTP batch script www.computing.net/answers/windows-2003/ftp-batch-script/5436.html