Breaking News
![](https://webspots.org/wp-content/uploads/2023/11/article-thumb-6-1024x614.webp)
![](https://webspots.org/wp-content/uploads/2023/11/article-thumb-15-1024x614.webp)
![](https://webspots.org/wp-content/uploads/2023/11/article-thumb-13-1024x614.webp)
Popular News
![](https://webspots.org/wp-content/uploads/2024/12/pexels-semac-14011035-1024x576.jpg)
![](https://webspots.org/wp-content/uploads/2025/01/background-823673_1280-1024x674.png)
Enter your email address below and subscribe to our newsletter
網路補給站
主要功用:rsync
是一個文件傳輸和同步工具,常用於在本地和遠程系統之間複製和同步文件。也可用於複製檔案資料夾使用。
常用參數如下:-a
:以歸檔模式運行,這會保留符號鏈接、權限、時間戳等。
-v
:顯示詳細的輸出。
-z
:在傳輸過程中進行壓縮。
-r
:遞歸地複製整個目錄。
-u
:僅複製源中較新的文件。-h
:文件大小在輸出中以更易讀的格式顯示。
--rsh
:指定遠程 shell 程序,通常用於設置 SSH 連接的選項。
--progress
:顯示文件傳輸的進度信息。
--delete
:刪除目標中在源中不存在的文件。
# SSH 連線並使用 sshkey # 連線到遠端 Server 同步備份檔到本地端 Server 並刪除本地端不相關的檔案 rsync --rsh='ssh -i ~/.ssh/sshkey' -avzrh --progress --delete UserName@IP:/YourBackupPath/ /LocalSavePath/
# 使用密碼 # 連線到遠端 Server 同步備份檔到本地端 Server 並刪除本地端不相關的檔案 rsync -avzrh --progress --delete UserName@IP:/YourBackupPath/ /LocalSavePath/