I am having problems getting a . directory in a subdirectory to be excluded when rsyncing. I am using rsync 3.1.2 on CentOS 7 and the command line is: #??? all files from ~/bin/ and I use want to exclude the directory ~/bin/docker/.git rsync -vHrltDium -c --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --stats --include='*' --include='*/' --exclude=".git/" -e "ssh -y -p 22" /home/user/bin/ user at 1.2.3.4:~/bin What am I doing wrong? I thought the exclusion pattern above would exclude any .git subdirectory regardless of level found? Thank you.
Order matters. --include overrides --exclude listed later. So, your exclude is nullified by both of your includes. So move the exclude before the includes. Of course then your includes will be irrelevant so just remove them unless you are leaving out details. On 12/28/19 9:15 PM, H via rsync wrote:> I am having problems getting a . directory in a subdirectory to be excluded when rsyncing. I am using rsync 3.1.2 on CentOS 7 and the command line is: > > #??? all files from ~/bin/ and I use want to exclude the directory ~/bin/docker/.git > rsync -vHrltDium -c --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --stats --include='*' --include='*/' --exclude=".git/" -e "ssh -y -p 22" /home/user/bin/ user at 1.2.3.4:~/bin > > What am I doing wrong? I thought the exclusion pattern above would exclude any .git subdirectory regardless of level found? > > Thank you. > >-- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: https://sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/rsync/attachments/20191228/e4535c0b/signature.sig>
On 12/28/2019 09:35 PM, Kevin Korb via rsync wrote:> Order matters. --include overrides --exclude listed later. So, your > exclude is nullified by both of your includes. So move the exclude > before the includes. Of course then your includes will be irrelevant so > just remove them unless you are leaving out details. > > On 12/28/19 9:15 PM, H via rsync wrote: >> I am having problems getting a . directory in a subdirectory to be excluded when rsyncing. I am using rsync 3.1.2 on CentOS 7 and the command line is: >> >> #??? all files from ~/bin/ and I use want to exclude the directory ~/bin/docker/.git >> rsync -vHrltDium -c --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --stats --include='*' --include='*/' --exclude=".git/" -e "ssh -y -p 22" /home/user/bin/ user at 1.2.3.4:~/bin >> >> What am I doing wrong? I thought the exclusion pattern above would exclude any .git subdirectory regardless of level found? >> >> Thank you. >> >> > >Thank you very much, worked perfectly! Clearly I need to read up on includes and excludes... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20191230/c5c072b1/attachment.htm>
Apparently Analagous Threads
- Excluding a . directory in a subdirectory
- #5209 patch: :dependent => :nullify deletes child records
- xen-unstable: commit commit 63753b3e0dc56efb1acf94fa46f3fee7bc59281c leaves HVM guest dangling after shutdown or destroy.
- Operation not supported (95)
- Operation not supported (95)