語法:scp [-r] source_file user@remote_hostname:target_file

-r
Use to recursively copy entire directories.

user
Login account to use on the remote host.

remote_hostname
The names of the remote host from or to which the file is to be copied.

target_file
The file name or directory name to be copied. Several source file names may be included on one command line.

例如:

複製檔案
scp test.txt root@192.168.10.100:/export/home

複製目錄
scp -r test root@192.168.10.100/export/home

-------------------------------------------------------------------------------------

語法:rsync -auvzP[r] --bwlimit=speed_value source_file user@remote_hostname:target_file

-a archive模式,保留檔案原有的屬性,是「-rlptgoD」的參數組合
-v 顯示同步過程的訊息
-r 遞廻模式,包含目錄及子目錄
-u 不覆蓋比較新的檔案,只更新來源檔案時間大於目的檔案的時間
-z 在傳輸的過程中進行壓縮
-P 等於s --partial --progress ,等於支持斷點續傳
--bwlimit 限制速度limit I/O bandwidth; KBytes per second

rsync具有差異備份、安全性等眾多的特性,唯檔案數量過多時,效率可能不佳。

複製檔案
rsync -auvzP --bwlimit=100 test.txt root@192.168.1.162:/export/home/testmgr

複製目錄
rsync -auvzPr --bwlimit=100 test root@192.168.1.162:/export/home/testmgr
arrow
arrow
    全站熱搜

    keven 發表在 痞客邦 留言(0) 人氣()