[HOW TO] rsync copy Directories Structures

Hello,

My name Tien.
I just finished to sync directories structures on SLES 11 (Linux). I think, i should share this job to everybody.

Firstly you need to install rsync on all source and destination. The differences between two sets of files accross the network connection, using an efficient checksum-search algorithm. Make sure it's installed on all server for remote copy.

Syntax:

rsync -av -f"+ */" -f"- *" /path/to/src /path/to/dest/
rsync -av -f"+ */" -f"- *" /path/to/src user@ip/domain:/path/to/dest/

If you are using an older rsync version, try:

rsync -av --include='*/' --exclude='*' /path/to/src /path/to/dest/
rsync -av --include='*/' --exclude='*' /path/to/src user@ip/domain:/path/to/dest/

References: http://www.cyberciti.biz/faq/unix-linux-bsdosx-copying-directory-structures-trees-rsync/




Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success

0 nhận xét:

Post a Comment