shell Replicate

@echo off

For /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set dDate=%%c-%%b-%%a)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set dTime=%%a%%b)

echo Replication Executed on %dDate% at %dTime%. >> "C:\Logs\Replication\%dDate%.log"

xcopy "C:\Websites\example.com" "\\192.168.1.2\c$\Websites\example.com" /D /E /V /C /F /H /R /Y /EXCLUDE:C:\Websites\example.com\id.html >> "C:\Logs\Replication\%dDate%.log"
Use the above to copy files between web servers, as a simple form of replication. It includes both date and time formatting to output as "on 2011-04-06 at 1635". See Stack Overflow.

Updated: Monday 9th May 2011, 20:44pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.