I have a script that runs robocopy using the /MIR switch<\/p>\n
When the content of the source files change they are not getting updated and when copied to the destination.<\/p>\n
I am trying to figure out how to:<\/p>\n
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.<\/p>\n
Basically I am trying to mirror the same information in both locations without deleting anything.<\/p>\n
Thanks for any feedback.<\/p>","upvoteCount":10,"answerCount":7,"datePublished":"2022-02-04T20:22:37.000Z","author":{"@type":"Person","name":"rickporcaro","url":"https://community.spiceworks.com/u/rickporcaro"},"suggestedAnswer":[{"@type":"Answer","text":"
I have a script that runs robocopy using the /MIR switch<\/p>\n
When the content of the source files change they are not getting updated and when copied to the destination.<\/p>\n
I am trying to figure out how to:<\/p>\n
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.<\/p>\n
Basically I am trying to mirror the same information in both locations without deleting anything.<\/p>\n
Thanks for any feedback.<\/p>","upvoteCount":10,"datePublished":"2022-02-04T20:22:37.000Z","url":"https://community.spiceworks.com/t/trying-to-copy-files-using-robocopy/824188/1","author":{"@type":"Person","name":"rickporcaro","url":"https://community.spiceworks.com/u/rickporcaro"}},{"@type":"Answer","text":"
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.<\/p>\n
Also, what’s triggering your script? Is it tied to a scheduled task or are you running it manually?<\/p>","upvoteCount":0,"datePublished":"2022-02-04T21:38:30.000Z","url":"https://community.spiceworks.com/t/trying-to-copy-files-using-robocopy/824188/2","author":{"@type":"Person","name":"ctransom","url":"https://community.spiceworks.com/u/ctransom"}},{"@type":"Answer","text":"
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.<\/p>\n
Here’s an example of a robocopy with /MIR that I used when migrating a file server. Sorry I may not have described what I am trying to do in full.<\/p>\n Folder\\files on the source system D:\\ drive get copied to the destination every day at 1:00 AM<\/p>\n Files will change on the source system and the destination files need to be overwritten to reflect the latest changes<\/p>\n Files on the source and destination system cannot be deleted as part of the script.<\/p>\n I am thinking maybe xcopy will do this ?<\/p>\n Thanks,<\/p>","upvoteCount":0,"datePublished":"2022-02-07T20:16:59.000Z","url":"https://community.spiceworks.com/t/trying-to-copy-files-using-robocopy/824188/4","author":{"@type":"Person","name":"rickporcaro","url":"https://community.spiceworks.com/u/rickporcaro"}},{"@type":"Answer","text":"
\nThis link explains the various switches other than MIR. the second link discusses that. Move shared folders and retain file and share permissions with robocopy<\/a>
\nRobocopy /MIR: Sync Files with Ease and Confidence<\/a><\/p>\nrobocopy \"\\\\oldserver\\F$\\sharename\" \"D:\\shares\\sharename\" /MIR /SEC /ZB /R:1 /W:1 /V /TEE /MT:16 /LOG+:\"D:\\robocopy_logs\\sharename.log\"\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2022-02-05T09:47:28.000Z","url":"https://community.spiceworks.com/t/trying-to-copy-files-using-robocopy/824188/3","author":{"@type":"Person","name":"jrp78","url":"https://community.spiceworks.com/u/jrp78"}},{"@type":"Answer","text":"