When you use either one of two options:
- /PURGE : Delete dest files/folders that no longer exist in source.
- /MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E)
example:
- robocopy /PURGE c:\source d:\destination
- robocopy /MIR c:\source d:\destination
Then you will delete files in the destination if they do not exist in the source.
Robocopy will also default to "By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes."
I would also suggest that you look into:
- /COPY:copyflag[s] : What to COPY (default is /COPY:DAT)
(copyflags : D=Data, A=Attributes, T=Timestamps
S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
example:
- robocopy /COPY:DAT c:\source d:\destination
That will make sure you get the same timestamps for the files that will be copied.