[英]rsync --exclude and --exclude-from not working
I've created a simple test directory:我创建了一个简单的测试目录:
├── backup.tgz
├── Dummy-dir
│ ├── dummy-file-a.txt
│ ├── dummy-file-b.txt
│ ├── Images
│ │ ├── imgA.jpg
│ │ ├── imgB.jpg
│ ├── Music
│ │ ├── Una Mattina - ludovico Einaudi (Jimmy Sax Impro live).mp3
│ │ └── Worakls - Blue ( Jimmy Sax live).mp3
│ └── Videos
│ ├── IMG_0001.MOV
│ └── IMG_5377.mov
├── Dummy-target
├── excludes.txt
To test, i did rsync of Dummy-dir
to Dummy-target
.为了测试,我做了Dummy-dir
到Dummy-target
的 rsync。
I ran multiple tests:我运行了多个测试:
rsync -avz --exclude ./Dummy-dir/Images ./Dummy-dir/ ./Dummy-target/
rsync -avz --exclude=./Dummy-dir/Images ./Dummy-dir/ ./Dummy-target/
rsync -avz --exclude-from=./excludes.txt ./Dummy-dir/ ./Dummy-target/
I tested both with relative and full path.我测试了相对路径和完整路径。
No matter what i try, it doesn't seems to work.无论我尝试什么,它似乎都不起作用。
What is going on?到底是怎么回事?
This should exclude Images
folder:这应该排除Images
文件夹:
rsync -avz --exclude 'Images' ./Dummy-dir/ ./Dummy-target/
should be relative to the source path without the source path应该是相对于没有源路径的源路径
and if you want to exclude multiple files / directories:如果你想排除多个文件/目录:
rsyc -avz --exlude={'Images','Music','dummy-file-a.txt'} src-directory/ dest-dirctory/
There must be no spaces in the list!列表中不能有空格! It will not work if there are!有就不行!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.