0

I want to merge with rsync a folder containing a newer version of wordpress with that of one that contains both the older version of wordpress and some theme work.

I want the merge to replace any files found in both with the new version and leave files which don't exist in the later version in place in the destination folder.

Then I will use git to determine whats changed and push it up.

How should I go about doing this?

1 Answer 1

1

It seems, rsync with an -a (archive, i.e. recursive through directories, and preserve permissions and symlinks etc, leave everything as much as it is as possible) and a -u (update, i.e. always preserve newer version) flags would do the job. (Perhaps a -v flag for verbose)

E.g.

rsync -auv /path/to/source/dir/ /path/to/target/dir/ 

or, if it is remote, you can also specify with the -e flag what remote shell you would like to use, e.g. with ssh

rsync -auv -e "ssh" /path/to/source/dir/ remoteusername@remoteserver:/target/path/on/remote/machine/ 

or the other way around

rsync -auv -e "ssh" remoteusername@remoteserver:/source/path/on/remote/machine/ /path/to/local/target/dir/ 

(Perhaps you might want to try with two test directories first to verify that it works before doing something that could overwrite something that is important and could thus do serious damage.)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. I used -auvr :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.