Friday, July 8, 2011

Script to Synchronise Author with Delivery

@ECHO OFF
SETLOCAL

::******************************************* Constants / ROBOCOPY Settings ***********************************************************

SET _what=/COPYALL /E
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
:: /E :: Copy Subfolders, including Empty Subfolders.

SET _options=/R:0 /W:0 /TS /FP /XO
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
:: /IS :: Include Same, overwrite files even if they are already the same. Use this options if you want to overwrite
:: /XO :: eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it.

SET _timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%
:: This will create a timestamp like yyyymmyyhhmm.

SET _source="C:\inetpub\source\Website"
:: Source of the files to copy from

SET _ExcludeDir= /XD App_Browsers App_Data data temp upload
SET _ExcludeFile= /XF *.specific.config ConnectionStrings.config web.config

::*************************************** End of Constants / ROBOCOPY Settings ********************************************************

:: Delivery 1
SET _dev1="\\delivery1\c$\inetpub\dev.website.com\Website"
SEt _dev1log="X:\delivery1\Deployment\Deployment Logs\APP01"\%_timestamp%.txt

Echo Synchronising Delivery Server 1 with CMS Server
ROBOCOPY %_source% %_dev1% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev1log%
Echo Synchronising to Delivery Server 1 has been completed!
:: End of Delivery 1

Echo.

:: Delivery 2
SET _dev2="\\delivery2\c$\inetpub\dev.website.com\Website"
SEt _dev2log="X:\delivery2\Deployment\Deployment Logs\APP02"\%_timestamp%.txt

Echo Synchronising Delivery Server 2 with CMS Server
ROBOCOPY %_source% %_dev2% %_what% %_options% %_ExcludeDir% %_ExcludeFile% /LOG:%_dev2log%
Echo Synchronising to Delivery Server 2 has been completed!
:: End of Delivery 2

pause

No comments:

Post a Comment