at the moment I am struggling to find a solution to include only files in a subdirectory but exclude all other stuff. File structure looks like this
$ tree ../
../
├── from
│ ├── a
│ │ ├── aa
│ │ │ └── x.txt
│ │ ├── a.txt
│ │ └── b.txt
│ └── b
│ ├── b.txt
│ └── c.txt
└── to
and only the stuff in a/aa/ shall be transferred into to/.
$ rsync -avh --include=a/aa/*** --exclude=* ../from/ ../to/
does not work and to/ stays empty but doing this with a/
$ rsync -avh --include=a/*** --exclude=* ../from/ ../to/
it works
$ tree ../
..
├── from
│ ├── a
│ │ ├── aa
│ │ │ └── x.txt
│ │ ├── a.txt
│ │ └── b.txt
│ └── b
│ ├── b.txt
│ └── c.txt
└── to
└── a
├── aa
│ └── x.txt
├── a.txt
└── b.txt
but there a.txt and b.txt should not be there. What did I miss?
Thanks for your help.
--include
and--exclude
; I'm not sure. But wouldn'tmkdir -p ../to/aa/a && rsync -avh ../from/aa/a/ ../to/aa/a/
be easier?