Created
October 6, 2014 22:03
-
-
Save swaters86/86c57ff367b4c5b335b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| set clustercode=%1 | |
| set environments_string=%2 | |
| set sitecodes_string=%3 | |
| for /f "tokens=*" %%a in (%environments_string%) do ( | |
| set environments=%%a | |
| for %%b in (%environments%) do ( | |
| setlocal enabledelayedexpansion | |
| echo. | |
| echo Checking to see if file exist for %%b ... | |
| echo. | |
| set environmentpath=\\sxatl\mn1\sites\MN1\Z_Temp_Checkout_Folder\CheckMeBeforeYouRun\%%b%.txt | |
| if exist !environmentpath! ( | |
| echo. | |
| echo File found for %%b | |
| echo. | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| echo ############### Starting Compare for Config Files for %%b ############################### | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| set config_source_path=\\sxatl\mn1\sites\MN1\Z_Temp_Checkout_Folder\%%b\%clustercode%\configFiles | |
| set config_destination_path=\\sxatl\tc1\sites\TC1\DFM_Sites\%clustercode%\%%b\configFiles | |
| REM checking if folder for config files exist | |
| if not exist !config_destination_path! ( | |
| echo ----------------------------------------------------------------------------------------- | |
| echo. | |
| echo Creating directory !config_destination_path! | |
| echo. | |
| echo ----------------------------------------------------------------------------------------- | |
| mkdir !config_destination_path! | |
| ) else ( | |
| echo ***************************************************************************************** | |
| echo. | |
| echo Directory for config files directory for %%b already exist or it couldn't been created. | |
| echo. | |
| echo ***************************************************************************************** | |
| ) | |
| REM compare source folder to destination folder contents by using beyond compare. | |
| echo. | |
| echo comparing !config_source_path! to !config_destination_path! | |
| echo. | |
| "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" /closescript "@BeyondCompareUpdate.txt" !config_source_path! !config_destination_path! | |
| echo. | |
| echo Files moved for config files | |
| echo. | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| echo ############### Starting Compare for Global Files for %%b ############################### | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| set globals_source_path=\\sxatl\mn1\sites\MN1\Z_Temp_Checkout_Folder\%%b\Globals | |
| set globals_destination_path=\\sxatl\tc1\sites\TC1\DFM_Sites\%clustercode%\%%b\globals | |
| REM checking if global folder exist | |
| if not exist !globals_destination_path! ( | |
| echo ----------------------------------------------------------------------------------------- | |
| echo. | |
| echo Creating directory !globals_destination_path! | |
| echo. | |
| echo ----------------------------------------------------------------------------------------- | |
| mkdir !globals_destination_path! | |
| ) else ( | |
| echo ***************************************************************************************** | |
| echo. | |
| echo A global directory for %%b already exist or it couldn't been created. | |
| echo. | |
| echo ***************************************************************************************** | |
| ) | |
| REM compare source folder to destination folder contents by using beyond compare. | |
| echo. | |
| echo comparing !globals_source_path! to !globals_destination_path! | |
| echo. | |
| "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" /closescript "@BeyondCompareUpdate.txt" !globals_source_path! !globals_destination_path! | |
| echo. | |
| echo Files moved for global files | |
| echo. | |
| for /f "tokens=*" %%c in (%sitecodes_string%) do ( | |
| set sitecodes=%%c | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| echo ############### Starting Compare for Site Code Folders in %%b ########################### | |
| echo. | |
| echo ######################################################################################### | |
| echo. | |
| REM iterate through sitecodes and create necessary site code folders | |
| REM and/or or start comparing the source folder and the destination folder by using Beyond Compare | |
| for %%d in (!sitecodes!) do ( | |
| set source_path=\\sxatl\mn1\sites\MN1\Z_Temp_Checkout_Folder\%%b\%clustercode%\%%d | |
| set destination_path=\\sxatl\tc1\sites\TC1\DFM_Sites\%clustercode%\%%b\%%d | |
| if not exist !destination_path! ( | |
| echo ----------------------------------------------------------------------------------------- | |
| echo. | |
| echo Creating directory !destination_path! | |
| echo. | |
| echo ----------------------------------------------------------------------------------------- | |
| mkdir !destination_path! | |
| ) else ( | |
| echo ***************************************************************************************** | |
| echo. | |
| echo Directory for site %%d in %%b already exist or it couldn't be created. | |
| echo. | |
| echo ***************************************************************************************** | |
| ) | |
| echo. | |
| echo comparing !source_path! to !destination_path! | |
| echo. | |
| "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" /closescript "@BeyondCompareUpdate.txt" !source_path! !destination_path! | |
| ) | |
| echo. | |
| echo Files moved for site specific folders | |
| echo. | |
| ) | |
| ) else ( | |
| echo ***************************************************************************************** | |
| echo. | |
| echo file NOT found for %%b | |
| echo. | |
| echo ***************************************************************************************** | |
| ) | |
| REM End decision that checks to see if the [environment].txt file exists | |
| REM Cleanup | |
| if exist !environmentpath! ( | |
| del !environmentpath! | |
| echo !environmentpath! was deleted | |
| ) else ( | |
| echo. | |
| echo !environmentpath! doesn't exist so it cannot be deleted | |
| echo. | |
| ) | |
| ) | |
| REM End FOR loop for getting each environments from the environments_string variable | |
| ) | |
| REM End FOR loop for getting list environments from command arguments | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment