Just to solve a challenge of dealing with legacy CMS that’s only specifically mapped to an old server. The contents need to be copied over to a new server periodically throughout the day and it has to act like a mirror (option /mir) in such a way that net new files are copied and any deleted directories and files are also reflected on the new server.
As the server was upgraded, there is a couple files that cannot be overriden. With the use of Windows Robocopy, certain directories such as App_Data and aspnet_client can be excluded (option /xd). In the same way, files like global.asa and web.config (option /xf).
Robocopy command:
robocopy \\shared\d$\itnota\ D:\itnota\ /mir /e /xd "App_Data" "aspnet_client" /xf "global.asa" "web.config" /log:"F:\migration.log"
The command then can be set on a task scheduler to run automatically.
More Windows Robocopy examples can be found on the links below (Further Reading).
Further Reading
Robocopy
Robocopy and a Few Examples
Robocopy /mir switch doesn’t copy security
MCSA Windows Server 2016 Complete Study Guide: Exam 70-740, Exam 70-741, Exam 70-742 and Composite Upgrade Exam 70-743 2nd Edition
Leave a Reply