Rsync
rsync:rsync 不移動某些文件
這是我的
rsync
命令:rsync -av --progress \ --exclude=".*" \ --exclude="target/*" \ --exclude="src/main/docker" \ --exclude="src/test" \ ~/projects/workarea/arxius-linia/backend/ \ ~/projects/workarea/arxius-linia/gene/backend/
然而,似乎有些東西不同步,因為:
$ diff -qr --exclude=.git --exclude=".*" \ ~/projects/workarea/arxius-linia/backend \ ~/projects/workarea/arxius-linia/gene/backend
diff
命令讓我有一些差異:Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/constants: BookConstants.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/constants: ParticipateConstants.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/controller: BookDocumentationController.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/controller/impl: BookDocumentationControllerImpl.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/controller/impl: ParticipateControllerImpl.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/controller: ParticipateController.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/dao: BookDocDAO.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/dao: BookDocumentationRepository.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/dao: ParticipateDAO.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/dao: ParticipateRepository.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/dao: StatisticsDAO.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/domain: BookDocumentationDomainModel.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/domain: BookUnitDomainModel.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/domain/form: BookDocumentationFormModel.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/domain/form: ParticipateFormModel.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/domain: ParticipateDomainModel.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/service: BookDocumentationService.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/java/net/gencat/clt/arxius/backend/service: ParticipateService.java Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/resources/mailTemplates: MailParticipateArchive.ftlh Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/resources/mailTemplates: MailParticipateValidation.ftlh Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/resources/mailTemplates: SubjectParticipateArchive.ftlh Only in /home/jeusdi/projects/workarea/arxius-linia/gene/backend/src/main/resources/mailTemplates: SubjectParticipateValidation.ftlh
有任何想法嗎?
您列出的文件
Only in ...
都位於目標目錄下。這意味著這些文件在您執行rsync
命令之前就已經存在。如果要從目標目錄中刪除這些文件,可以使用該選項執行該
rsync
命令。--delete
這樣做會刪除源目錄層次結構中不存在的目標目錄層次結構中的所有文件。--delete-excluded
如果您需要刪除目標上與您的任何排除模式匹配的文件,您可能還需要使用該選項進行調查。考慮首先在數據副本上進行測試,或者至少使用
--dry-run
選項(或-n
)來查看哪些文件rsync
將被刪除,並始終進行頻繁備份。