0

robocopy makes it easy to mirror a single directory onto a target directory.

But what if I have two source directories with disjoint sets of files and I want the merge of them to be mirrored? I do not want any auxiliary copyings.

The directories are quite big, so passing a list of files on the robocopy command line is out of the question.

mark
  • 691
  • 2
  • 14
  • 31
  • have you considered `rsync`? – danblack Sep 30 '18 at 04:58
  • No, I have not. I have never tried it. If you know the required command line, it would be the perfect answer. – mark Oct 01 '18 at 01:37
  • `rsync -a SRC1 SRC2 DESTINATION` should be pretty close, it doesn't have delete options. test first. If you want something close to real time [lsyncd](https://axkibe.github.io/lsyncd/) – danblack Oct 01 '18 at 02:26
  • I am trying to figure out the exact command line. A project, I would say. Your command line does not work well, because the created directory has no write permissions even for the owner, plus the SRC1 and SRC2 folders are created under DESTINATION. This is not a merger. – mark Oct 01 '18 at 13:14
  • So, changing `SRC1 SRC2` to `SRC1/ SRC2/` solves the merger issue. But the permissions is a mystery. The `-a` flag is supposed to preserve permissions, yet it does not on windows. Still checking ... – mark Oct 01 '18 at 13:25
  • `rsync.exe -a --no-p --no-g --chmod=ugo=rwX --delete SRC1/ SRC2/ DESTINATION` seems to do the trick. Would you mind arranging your comment (please, incorporate my comment too) as an answer so I could credit you? – mark Oct 01 '18 at 13:33

0 Answers0