Solved

robocopy to copy changes

Posted on 2014-09-08
8
301 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 83

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
 
LVL 83

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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 83

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

914 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

18 Experts available now in Live!

Get 1:1 Help Now