How to rsync folder recursively?


Short answer:
Code:
rsync -av source/ destication/

Let us see a practical guide using our test setup,
The source directory:
Code:
[admin@devopsrun1 ~]$ ls -l source/
total 0
-rw-rw-r-- 1 admin admin 0 Jan  1  2009 file1.txt
-rw-rw-r-- 1 admin admin 0 Dec  5  2009 file2.txt
-rw-rw-r-- 1 admin admin 0 Jan  6  2010 file3.txt
-rw-rw-r-- 1 admin admin 0 Jan  2  2010 file4.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file5.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file6.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file7.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file8.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file9.txt
[admin@devopsrun1 ~]$

Destination directory:
Code:
[admin@devopsrun1 ~]$ ls -l destication/
total 0
It is empty.

RSYNC Copying from source to destination


Use rsync with switches, a and v
-a for all files and directories synchronizing
-v verbose - show what is going on
Code:
rsync -av source/ destication/

Example:
Code:
[admin@devopsrun1 ~]$ rsync -av source/ destication/
sending incremental file list
./
file1.txt
file2.txt
file3.txt
file4.txt
file5.txt
file6.txt
file7.txt
file8.txt
file9.txt

sent 568 bytes  received 190 bytes  1,516.00 bytes/sec
total size is 0  speedup is 0.00
[admin@devopsrun1 ~]$

Verifying destination


Code:
[admin@devopsrun1 ~]$ ls -l destication/
total 0
-rw-rw-r-- 1 admin admin 0 Jan  1  2009 file1.txt
-rw-rw-r-- 1 admin admin 0 Dec  5  2009 file2.txt
-rw-rw-r-- 1 admin admin 0 Jan  6  2010 file3.txt
-rw-rw-r-- 1 admin admin 0 Jan  2  2010 file4.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file5.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file6.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file7.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file8.txt
-rw-rw-r-- 1 admin admin 0 May 22 15:04 file9.txt
[admin@devopsrun1 ~]$