

Now we see the scripts directory copied too, the difference is the trailing trash, If you dont specify the trailing slash, it copies the directory too. Sent 1, 076 bytes received 77 bytes 2, 306.00 bytes/sec Lets see if we can copy the whole directory now with files rsync -ztva /home/downloads/home/scripts. rwxr-xr-x 1 root root 47 [ 0m[ 01 32mget_free_memory.sh[0m ls -lrt get_free_memory.sh get_ipaddr.sh prepare.sh Seems like we didnt get the scripts directory, Lets see if we got the files. Ls: cannot access scripts: No such file or directory Seems like it has worked, let see if we got all the files and also the scripts directory pwd Sent 1, 059 bytes received 76 bytes 2, 270.00 bytes/sec We need to add the switch -a (archive) rsync -ztva /home/downloads/home/scripts/. Sent 16 bytes received 12 bytes 56.00 bytes/secĪs we see above the same didnt work. Lets try to copy the whole directory scripts with all the files in it rsync -ztv /home/downloads/home/scripts. Get_free_memory.sh get_ipaddr.sh prepare.sh Following scripts directory has few files in it. Sent 44 bytes received 12 bytes 112.00 bytes/sec You can also use verbose mode to print information rsync -ztv /home/downloads/SampleData.xlsx. If the file is too big, use the -z compress switch, Rsync will compress the files before transfer rsync -zt /home/downloads/SampleData.xlsx. Now we got the file and also preserved the timestamp rw-r-r- 1 root root 65801 SampleData.xlsx To keep the original timestamp rsync -t /home/downloads/SampleData.xlsx. Yes we got the file in the directory /tmp/ directory but the time stamp has changed. Lets copy the above file /home/downloads/SampleData.xlsx to our current directory /tmp rsync /home/downloads/SampleData.xlsx. rw-rw-r- 1 root root 65801 Oct 31 2018 /home/downloads/SampleData.xlsx Lets start with a simple case where we want to copy a single file from source to destination.
#GRSYNC TWO COMPUTERS NETWORK HOW TO#
How to use Rsync and Grsync to securely copy files
