使用 rsync 保留圖標

使用 rsync 保留圖標

我的印像是這裡在其他研究中,rsync 是用於同步目錄及其所有內容的命令。

我嘗試過以下命令:

rsync -avzr ~/testing123 ~/Desktop/apartment
sudo rsync -avzr ~/testing123 ~/Desktop/apartment

它們都不保留圖標,它們都產生相同的結果:

sent 544 bytes  received 92 bytes  1272.00 bytes/sec
total size is 6148  speedup is 9.67
building file list ... done
created directory /Users/null/Desktop/apartment
testing123/
testing123/.DS_Store
testing123/Icon\#015
testing123/info.txt

sent 566 bytes  received 92 bytes  1316.00 bytes/sec
total size is 6166  speedup is 9.37

它們都正確同步文件,但不保留原始文件或目錄中的圖示。對於目錄,這兩個命令不是在資料夾上保留圖標,而是在目標目錄中創建一個名為“Icon”的“0 KB”文件,不帶擴展名。對於文件,它什麼都不做,沒有神秘的“圖標”文件,也沒有實際的圖標。

是我使用了錯誤的論點的問題嗎?這裡有什麼問題?為什麼實際上不會rsync在目標文件上創建與來源文件相同的圖示?

答案1

您需要指定該-E選項rsync

   -E, --extended-attributes
          Apple specific option  to  copy  extended  attributes,  resource
          forks,  and  ACLs.   Requires at least Mac OS X 10.4 or suitably
          patched rsync.

圖示儲存在 HFS+ 資源分支中。

相關內容