How to synchronize two local file structures

I have two large source trees. One of them has some outdated image files. I would like to automatically update all old image files (png, jpg, gif) in one source tree with updated image files in another source tree.

I am using Windows 7, but I have Cygwin installed. I have tried using rsync so far, but without success.

I was hoping I could do something like:

rsync -r *.png newSourceTree oldSourceTree 

If there is another way to achieve the same, for example. Perl or Bash script, I will also be open to use.

Any help would be greatly appreciated.

Thanks, James.

+4
source share
3 answers

What about:

 robocopy c:\source\ c:\destination\ *.png *.gif /s 
+1
source

Do you want to:

 rsync -av --include '*.png' --include '*/' --exclude '*' newSourceTree/ oldSourceTree/ 

Short explanation: You want to include png files, include all directories (so that it can recursively), and then exclude everything else. Include / Exclude are processed from left to right and by default include everything.

+2
source

Unison is designed for this kind of problem. You can sync all files with

 unison oldTree newTree -force newer 

If you want it to apply only to image files, read the documentation.

+1
source

Source: https://habr.com/ru/post/1306701/


All Articles