Solved

robocopy to copy changes

Posted on 2014-09-08
8
289 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 82

Accepted Solution

by:
oBdA earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:oBdA
Comment Utility
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
Comment Utility
Ok, I will test and report back. Thank you very much!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now