2011-11-06 92 views
2

我嘗試同步郵件目錄的目錄,此目錄郵件目錄中的一些文件夾包含開始的目錄「點」如何以點開頭的rsync文件夾?

.Archive/ 
.Sent Items/ 

我用下面

$ rsync -pogutr --exclude="." --exclude=".." .* /home/folder1/mail/domain/user1/ /home/folder2/mail/domain --progress 
$ rsync -pogutr --exclude="../" /home/folder1/mail/domain/user1/.* /home/folder2/mail/domain/ --progress 
$ rsync -pogutr --include=".*" /home/folder1/mail/domain/user1 /home/folder2/mail/domain/ --progress 

所有這一切都將同步嘗試/home/folder1/mail/domain/中的其他子目錄放入/home/folder2/mail/domain/user1/目錄中。

例如,如果/home/folder1/mail/domain/包含user1,user2和user3的子目錄。然後user1,user2和user3的所有內容將位於/home/folder2/mail/domain/user1/目錄中

回答

-1

嘗試使用unison而不是rsync。另外,它會更快地同步。

+0

http://www.cis.upenn.edu/~bcpierce/unison/status.html 齊奏不再作爲一個研究項目積極發展。 – deejayy

0

我僞造了一個包含文件的點文件夾的郵件目錄,默認情況下它同步正確。

$ rsync --recursive --verbose maildir/ maildir-backup 
sending incremental file list 
created directory maildir-backup 
./ 
.Archive/ 
.Archive/1 
.Archive/2 
.Archive/3 
.Sent Items/ 
.Sent Items/bar 
.Sent Items/baz 
.Sent Items/foo 

sent 481 bytes received 182 bytes 1,326.00 bytes/sec 
total size is 0 speedup is 0.00 

我甚至試過你正在使用(保留所有者,組,時間,權限等)

$ rsync -pogutr --verbose maildir/ maildir-backup 
sending incremental file list 
created directory maildir-backup 
./ 
.Archive/ 
.Archive/1 
.Archive/2 
.Archive/3 
.Sent Items/ 
.Sent Items/bar 
.Sent Items/baz 
.Sent Items/foo 

sent 497 bytes received 182 bytes 452.67 bytes/sec 
total size is 0 speedup is 0.00 

你只是不希望或需要排除「這」額外的標誌文件夾或父母。這些不包含在任何路徑中。

--exclude="." --exclude=".." 
0

使用2個rsync命令:1點和1點文件夾。並指定點並轉義它。 我用它遷移到泊塢窗,郵政和運行此我搬運工主機上:

rsync -e ssh -v -r -u [email protected]:/home/benny/Maildir/* /mnt/user/docker/poste/data/domains/example.com/benny/Maildir/ 
rsync -e ssh -v -r -u [email protected]:/home/benny/Maildir/\.* /mnt/user/docker/poste/data/domains/example.com/benny/Maildir/ 
相關問題