I have 2 directories which have the similiar structure.
I would like to merge projectA into projectB. If a directory or file existing in A and not existing in B, do svn copy from A to B to the according target. If a file in A has an according file in B, echo a warning. How can I do this automatically? It can be shell scripts or tools....
With this command you get all files that are in
projectA but not in
projectB, ignoring the
diff -qr projectA projectB --exclude=.svn | grep "^Only in projectA:" | cut -d: -f2 | sed 's/^ *//g
With this command you get all files that exist in both folders and that differ (i.e. files you might need to check before copying):
diff -qr projectA projectB --exclude=.svn | grep "^Files " | cut -d" " -f2 | sed 's!projectA!!g'
The second command will not work with files that have spaces in them, though.
Now that you've got two lists with the file names you need, you can easily write a small script that does the right thing with them.