Solved

robocopy to copy changes

Posted on 2014-09-08
8
337 Views
Last Modified: 2014-11-12
hi,

We are copying some data across the network using robocopy, which we tested and works fine, but we would like to copy the data in advance, and then just copy the changes on the day. These are the switches we use for the initial copy:

robocopy  /COPY:DATSO /Z /B /E /R:3 W:5 /V /LOG:c:\_robocopy\log.txt


What do I need to use to only copy new and changed files, overwriting the older versions on the target location? I tried looking at gui versions like richcopy and robomirror, but had some problems and crashes, so we decided to stick to what was tested and worked.

Thanks!
0
Comment
Question by:rookie_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 250 total points
ID: 40309795
Basically, you just run the same command again. robocopy will by default skip files that already exist in the target folder (based on same size and same time stamp).
If you want to delete files in the target that have been removed from the source in the meantime, use /MIR instead of /E.
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 250 total points
ID: 40309796
Your commandline will already do that.... one of the great things of robocopy.... it will run down and show you the files but not actually copy anything if they are the same.

If you add /purge though it will also delete from the destination (only) if the file no longer exists in the source dir to make sure they are in sync.

Only other things to be careful with is if you, say, clear the old area and someone runs the script again with /purge it will all disappear off the new area too.

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40309803
We crossed posts there obviously... both saying same in different ways, to clarify as oBdA says you can change /E for /MIR or use /E and /PURGE which do exactly the same.

Steve
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 85

Expert Comment

by:oBdA
ID: 40309809
Oh, and since you're writing to a log file, you should add /NP ("no progress") to prevent the control characters required for the progress bar from cluttering up your log file, and if you want to see the log output in the command prompt while robocopy is working, you can add "/TEE".
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40309834
Yes that has to be one of the few annoying aspects of robocopy... would be quite handy to have it show percentage progress on the screen, while still logging the success/fail to the log file!
0
 

Author Comment

by:rookie_b
ID: 40309901
Ok,

So, if I understand correctly, if I run the script below it will:
-copy new files

-delete files from target no longer on source

-overwrite existing files that have changed if the target is older than source, but ignore if target is newer than source (or will it change the source if target is newer?)



robocopy  /COPY:DATSO /Z /B /MIR /NP /TEE /R:3 W:5 /V /LOG:c:\_robocopy\log.txt
0
 
LVL 85

Expert Comment

by:oBdA
ID: 40309928
Close. robocopy will by default overwrite files that differ from the source. It will never do anything to the source, unless you use "/MOV(E)".
If you really need to prevent it from overwriting newer files, you can add /XO (eXclude Older), but that is really only required if you're changing files both in source and in target between the initial copy and the last diff copy (which I wouldn't recommend).
Note, too, that, if a user isn't happy with a newer file version that is already in the target folder, and restores it to an older version again before the diff, his change will be lost after a diff with /XO.
0
 

Author Comment

by:rookie_b
ID: 40309986
Ok, I will test and report back. Thank you very much!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question