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
.
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:
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.