Discussion:
bidirectional robocopy sync
(too old to reply)
Jeff Vandervoort
2010-02-16 04:23:13 UTC
Permalink
Trying to set up near-real-time bidirectional sync between 2 folders on a
Win 7 client and an SBS2008 server. Offline files won't work because of the
way in which an app I use writes it's files; it has to be a local file or it
can take hours to save. But I want the files replicated to the server, and
from there to another client machine, using the same approach.

I *think* I've actually done pulled this off in the past...but it isn't
working now. These are my command lines:

ROBOCOPY "\\servername\sharename\foldername"
"\\clientname\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext

ROBOCOPY "\\clientname\sharename\foldername"
"\\servername\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext

Either command, run by itself, syncs source to destination just fine. But
when both are running simultaneously, files added in one folder will
subsequently be deleted as "Extra" files when discovered by one of the two
processes. Whether it gets copied or deleted just depends on which ROBOCOPY
command "discovers" the file first.

I read on some thread somewhere that /XO is needed for bi-directional syncs,
and that appears to be backed up by the Robocopy documentation. So I
included it in the command line, but it doesn't make any difference. (And
I'm using /TBD because the client machine is a notebook that's not always
connected.)

Wish you could set up DFSR with Win 7! I tried SyncToy 2.1 and couldn't get
it to run from Task Scheduler, so I gave up on that. DeltaCopy mangled the
ACLs and created several GB of recursive copies on both machines that took
some effort to undo. I know now what I did wrong with DeltaCopy and can
probably do it right the next time...but I'd really like to stick with
Robocopy if it can do the job. Can it?
--
Jeff Vandervoort
JRVsystems
http://www.jrvsystems.com
Jeff Vandervoort
2010-02-16 15:35:47 UTC
Permalink
"I *think* I've actually done pulled this off"

I can't believe I done wrote that.<g> Editing error!
--
Jeff Vandervoort
JRVsystems
http://www.jrvsystems.com
Post by Jeff Vandervoort
Trying to set up near-real-time bidirectional sync between 2 folders on a
Win 7 client and an SBS2008 server. Offline files won't work because of
the way in which an app I use writes it's files; it has to be a local file
or it can take hours to save. But I want the files replicated to the
server, and from there to another client machine, using the same approach.
I *think* I've actually done pulled this off in the past...but it isn't
ROBOCOPY "\\servername\sharename\foldername"
"\\clientname\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext
ROBOCOPY "\\clientname\sharename\foldername"
"\\servername\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext
Either command, run by itself, syncs source to destination just fine. But
when both are running simultaneously, files added in one folder will
subsequently be deleted as "Extra" files when discovered by one of the two
processes. Whether it gets copied or deleted just depends on which
ROBOCOPY command "discovers" the file first.
I read on some thread somewhere that /XO is needed for bi-directional
syncs, and that appears to be backed up by the Robocopy documentation. So
I included it in the command line, but it doesn't make any difference.
(And I'm using /TBD because the client machine is a notebook that's not
always connected.)
Wish you could set up DFSR with Win 7! I tried SyncToy 2.1 and couldn't
get it to run from Task Scheduler, so I gave up on that. DeltaCopy mangled
the ACLs and created several GB of recursive copies on both machines that
took some effort to undo. I know now what I did wrong with DeltaCopy and
can probably do it right the next time...but I'd really like to stick with
Robocopy if it can do the job. Can it?
--
Jeff Vandervoort
JRVsystems
http://www.jrvsystems.com
c***@gmail.com
2014-01-15 14:19:11 UTC
Permalink
Post by Jeff Vandervoort
ROBOCOPY "\\servername\sharename\foldername"
"\\clientname\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext
ROBOCOPY "\\clientname\sharename\foldername"
"\\servername\sharename\foldername" /MIR /MON:1 /TBD /XO /XF filename.ext
I know this is an old post, but as I found it, others may too and it can still be useful.

I think the reason the commands above don't work is because of the use of the /MIR option, which is equivalent to /E (copy even empty directories) and /PURGE (delete files in the destination that are not in the source)

This is why 'EXTRA' files are being deleted.

Instead, replace /MIR with /E and this will stop.

It does mean though that if a file really is to be deleted, then the file on both servers needs to be deleted before ROBOCOPY is run again, or it will get copied again.
Loading...