How can I solve this issue in batch?

The problem is when I start the script it will copy the folder and rename it and add the current date and time to the name. But while the script is running and changes in the folder were made it would overwrites the old folder with the old date without the /E /XC /XN /XO .

So how can I let the script always copy the folder from source to destination and update the date so it won’t get overwritten with the old folder?


@echo off
color 2

Set Source=C:\source
Set Destination=C:\destination
Set Folder=FolderName
Set currentdate=%date:/=-%_%time::=-%

robocopy "%Source%" "%Destination%\ %currentdate% %Folder%" /E /XC /XN /XO /mon:1 /mot:1