Using rsync to Sync Two Directories
July 27, 2023 —
Gregg Szumowski
You can sync two directories using rsync tool. The following command:
$ rsync -a -v --delete sending_directory target_directory;
will copy sending_directory to target_directory
creating a directory structure of
sending_directory/target_directory. The --delete
flag will ensure that any files that were previously in
sending_directory/target_directory that are not in
sending_directory will be deleted so that the contents of the
two directories are the same.