(1) rsync
rsync -a dir1/ dir2
This will archive and copy directory dir1 recursively to dir2.
The -a option is a combination flag.
It stands for "archive" and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.
If you want to copy to another machine as destination. Just add the machine full name as the prefix for
dir2.
syntax:
rsync -a dir1/ user_name@neodynium.bell.ca:dir2
e.g:
rsync -a test1/ jyj407@tj12.zte.com.cn:test2
The above command copies test1 directory recursively from the current machine to the remote
tj12.zte.com.cn machine directory test2. Here, ':' colon symbol stands for the home directory for user
jyj407.
(2) Another way is use scp.
scp -r dir1/ user_name@neodynium.bell.ca:dir2
The scp command is similar to rsync, but slower than rsync, especially for large directory with
tons of files. Also rsync does incremental copy, scp will copy everything. So generally speaking,
I would recommend using 'rsync' instead of 'scp'.
No comments:
Post a Comment