tags:

views:

122

answers:

3

Hi,

I have two large source trees. One of them has some out of date image files. I would like to automatically update all the old image files (png, jpg, gif) in one source tree with the up to date image files in the other source tree.

I am using Windows 7 but I have Cygwin installed. I have tried using rsync so far but with no success.

I was hoping I could do something like:

rsync -r *.png newSourceTree oldSourceTree

If there is some other way of achieving the same thing e.g. a Perl or Bash script, I'd be open to using that too.

Any help would be much appreciated.

Thanks, James.

+1  A: 

What about:

robocopy c:\source\ c:\destination\ *.png *.gif /s
Alex K.
Thanks Alex. I didn't even consider a Windows solution :/
James
+1  A: 

You want:

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

A quick explanation: You want to include png files, include all directories (so that it can recurse), then exclude everything else. Include/Exclude are processed left to right, and default to including everything.

jmanning2k
+1  A: 

Unison is designed for exactly this sort of problem. You can synchronize all the files using

unison oldTree newTree -force newer

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

Norman Ramsey