I am trying to copy a project to my server with rsync.
I have project specific install scripts in a subdirectory
What I am trying to do is exclude everything in the project/specs directory but the project specific install directory: project/specs/install/project1.
rsync -avz --delete --include=specs/install/project1 \
--exclude=specs/* /srv/http/projects/project/ \
Sometime it's just a detail.
Just change your include pattern adding a trailing / at the end of include pattern and it'll work:
rsync -avz --delete --include=specs/install/project1/ \ --exclude=specs/* /srv/http/projects/project/ \ firstname.lastname@example.org:~/projects/project
Or, in alternative, prepare a filter file like this:
$ cat << EOF >pattern.txt > + specs/install/project1/ > - specs/* > EOF
Then use the --filter option:
rsync -avz --delete --filter=". pattern.txt" \ /srv/http/projects/project/ \ email@example.com:~/projects/project
For further info go to the FILTER RULES section in the rsync(1) manual page.