@echo Off
set DirDate=%date:~-10,2%.%date:~-7,2%.%date:~-4,4%
set Name1=IMG_DB_Sync_"%DirDate%"
set Name3=IMG_DB_RoboCopy"%DirDate%"
echo ====%time% - Parameters have been set==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
echo ====%time% - RoboCopy Starting for Image DataBase Sync==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
@echo Off
Robocopy /mir /S /j /R:5 /W:15 /MT:8 "\\Source_Serverr\SharedFolder$\!IMAGE DATABASE" "\\Dest_Server\SharedFolder$\!IMAGE DATABASE" /xf ".DS_Store" /LOG:\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name3%.log /v /ts /fp
echo ====%time% - RoboCopy for IMG_DB Sync Finished==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
@echo Off
echo ====%time% - Sending IMG_DB_Sync_RoboCopy log==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
powershell.exe -command "& {Send-MailMessage -SmtpServer 'smtp.server.com' -From 'foldersync@domain.com' -To 'IT@domain.com' -Subject 'File Sync' -Body 'Please see attached log for details' -Attachments '\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name3%.log'}"
echo ====%time% - Sent IMG_DB_RoboCopy log file==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
@echo Off
echo ====%time% - Log Cleanup Starting. ==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
ForFiles /p "\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS" /s /d -30 /c "cmd /c del @file & echo @path" >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo: >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ====%time% - Log Cleanup Completed. ==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
;
@echo Off
echo ====%time% - Image DataBase has been synced==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
;
End
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Expert of the Year award recognizes an expert who helped improve Experts Exchange in the past year through high levels of contributions and participation on site. This award is given to the expert who has achieved the highest levels of participation, while maintaining quality contributions and professionalism.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.