Transferring and Synchronizing Files with rsync
Explore how to use the rsync command to transfer and synchronize files and directories locally and remotely. Learn techniques to update only changed files, delete obsolete files, compress data for faster transfer, and validate actions using dry runs, enhancing your file management skills on the command line.
We'll cover the following...
rsync
The rsync program can copy files and folders between two locations on the same system and transfer files between local and remote locations.
Let’s use rsync to transfer the testsite directory from one user to another. This time, we copy it to a new folder named testsite2.
We execute this command to perform the copy:
rsync -v -r testsite/ {username}@{ip}:testsite2
Notice the trailing slash for the source. This tells rsync to copy the directory contents to the destination rather than the directory itself. Unlike the scp ...