I have a script that runs robocopy using the /MIR switch

When the content of the source files change they are not getting updated and when copied to the destination.

I am trying to figure out how to:

Copy files from source (that change) and have the changes in the files reflect in the destination location without deleting the files in either location.

Basically I am trying to mirror the same information in both locations without deleting anything.

Thanks for any feedback.

10 Spice ups

If you don’t want files to get deleted then you shouldn’t use the /mir parameter. It will delete files in the destination directory that are no longer in the source directory. Running the command without that parameter will copy whatever’s in the source directory to the destination while skipping duplicate files (files that have not changed). To copy subdirectories as well, use /S to copy all non-empty ones or /E to include empty ones too.

Also, what’s triggering your script? Is it tied to a scheduled task or are you running it manually?

If you want the source and destination to match then /MIR should work. Post your command for review. You say you don’t want to delete anything but to clarify, if you delete something in the source and robocopy to the destination with /MIR, those deleted files would be deleted in the destination to make them match. You are mirroring the source to the destination.

Here’s an example of a robocopy with /MIR that I used when migrating a file server.
This link explains the various switches other than MIR. the second link discusses that. Move shared folders and retain file and share permissions with robocopy
Robocopy /MIR: Sync Files with Ease and Confidence

robocopy "\\oldserver\F$\sharename" "D:\shares\sharename" /MIR /SEC /ZB /R:1 /W:1 /V /TEE /MT:16 /LOG+:"D:\robocopy_logs\sharename.log"

Sorry I may not have described what I am trying to do in full.

Folder\files on the source system D:\ drive get copied to the destination every day at 1:00 AM

Files will change on the source system and the destination files need to be overwritten to reflect the latest changes

Files on the source and destination system cannot be deleted as part of the script.

I am thinking maybe xcopy will do this ?

Thanks,

Robocopy will work perfectly fine for your purposes. As I said in my previous response, as long as you don’t use the mirroring parameter, nothing will be deleted. You would need to put the commands in a script/batch file then create a scheduled task to execute it at 1AM daily.

Use the command below as a template. You would just need to insert the source path and the destination path. It will copy everything (including subdirectories) from the source to the destination. It will also only copy files that have changed and skip those that have not.

robocopy <src path> <dst path> /E

It’s really that simple. Additionally, you can use the /L parameter to make sure it works as expected. It will output the results of executing the command without actually copying any files.
Also when creating the scheduled task, make sure the user account you’re running it from has the appropriate permissions to the source and destination paths.

Although Robocopy can does the job as experts said, but I see you can do this job by just few steps using a GUI backup tool, Syncback or GsRichcopy360 can copy the changes only, so the destination will be the same as the source, and you can set this job to run daily automatically, and just the changes will be copied and no need to copy the whole folder again, and nothing will be deleted, also both can copy in real time