For the syncing part(s) of your list – since you want to transfer bidirectionally – you may also have a look at unison, which is similar but different to rsync. You may can run it before and after your command and it will keep both sides in sync.
Similar to rsync:
- transport via SSH (as well as local and others)
- differential transfer under the hood, if parts of the files are the same, they do not need to be transmitted completely, but only the changed (or different) parts are transfered and the whole file is reconstructed on the other side, very useful to reduce bandwidth usage
Different to rsync:
- needs unsion on both ends – and it is very picky about the unison version number
- bidirectional sync: syncs files changed since the last sync on one end to the other end – and it detects if both were changed and either ignores it or lets you choose
- a textui and gui for interactive use is available as well as a non-interactive mode
If you want to make the copying direction explicit, I would also suggest rsync, as did jvb in
https://superuser.com/a/1219619/738892 – also starting with --dry-run
(or -n
for short) is very helpful. Atties comment about the slashes is important, too: start with -av
for copying the directory (with output – to see what happens).
You may or may not want to use --del
and friends, depending on whether you want to delete files which vanished from the SRC in the DEST. Depending on your use case, --update
(skips files that are newer on DEST), may be useful to you.