Does Rsync Allow Files To Be Synced Both Ways?

Solution 1:

Rsync does a one way sync, however it's up to you to decide which way the sync goes.

Rsync command syntax is the following:

rsync [OPTION...] SRC... [DEST]

Note that you specify sync from source to destination. Source and destination can be any local or remote path.

For example if you want to copy files from your server to your laptop you do:

rsync [OPTION...] <server-path> <laptop-path>

To sync in the opposite direction you do:

rsync [OPTION...] <laptop-path> <server-path>

So to answer your question: it depends on how you execute rsync.

If you want files to be deleted on the destination you need to use --delete option. But be careful with it, because if you make a mistake when specifying your source then you will end up removing everything on your destination. It's safer to test your sync without --delete option first and once you are happy with how it works you can add --delete option.

As suggested by masegaloeh in comments below, -n or --dry-run option may also be used to test rsync command behavior.

Solution 2:

A wrapper tool written in python3 called bsync which wraps find and rsync command simplifies the task. Github repo: https://github.com/dooblem/bsync

Don't be scared when it is on github (i.e. in a way that you think you must be a programmer to use the tool).