Using rsync to sync files.
rsync -avh source_folder/ target_folder/
- -a: archive mode
- -v: verbose
- -h: human readable
- -u: update only (preserve newer files)
- -H: preserve the hard link
- –progress: shows progress
- -n: dry run (without actual copying)
By the way, “/home/user/dir/” and “/home/usr/dir” are not the same thing to rsync. Without the final slash, rsync will copy the directory in its entirety. With the trailing slash, it will copy the contents of the directory but won’t recreate the directory.
For more explanations, check this nice post.