Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

robocopy to copy changes

Posted on 2014-09-08
8
Medium Priority
?
344 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 1000 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 1000 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

670 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