Dave.Turner@VerizonWireless.com
2004-Apr-21 20:52 UTC
exclude-from and include-from confusion
Learning rsync (love it) and am requesting some help in understanding the exclude-from/include-from rules. I've been doing some testing and the results aren't coming out as I expected. Problem: I have a directory with several dozen sub directories and would like to selectively pick a couple dozen directories to remotely copy. The issue is that there are a large number of directories and I want to keep the conf file and exclude/include files as simple and efficient as possible. I'm using /export/home/jetson as my home dir for this test. My Understanding: - Only one directory can be listed in the PATH module option. - Any directory or file listed in the exclude file will NOT be copied. - Any directory of file listed in the include file WILL be copied no matter what is in the exclude file. (thus allowing me to exclude *.zip files while including davet.zip.) - I realize I could create additional modules, however, I'd like to avoid creating a dozen modules, possibly with different exclude/include files. My Confusion: Using the exclude and include combo below, I thought I would be able to list just the directories I want to copy and thus avoid having large and confusing lists. However, the result is the the testdir/ directory and it's subdirectories are still ignored. What am I missing? Is my syntax wrong for the exclude/include files? Command line: /usr/local/bin/rsync -av --exclude-from=/davet/rsync.exclude --include-from=/davet/rsync.include --stats jetson@primey::jetson /export/home/jetson Module: [jetson] path = /export/home/jetson/ read only = yes list = yes Exclude File: * Include File: /export/home/jetson/testdir/* Thanks, Dave
On Wed, Apr 21, 2004 at 04:51:57PM -0400, Dave.Turner@VerizonWireless.com wrote:> - Any directory or file listed in the exclude file will NOT be copied. > - Any directory of file listed in the include file WILL be copied no matter > what is in the exclude file.Only if the include comes before the exclude in the list of all includes and excludes. If you reverse the order of your --exclude-from and --include-from options that would give the includes priority over the excludes. However, I'd recommend joining both files into a single file using explicit "+ " and "- " prefixes and switching over to just one --exclude-from=combo_file option. E.g.: + /testdir/ + /testdir/* - * (Note the explicit inclusion of the parent directory -- see the man page's discssion of how patterns are applied recursively.) Another solution that would work for the simple set of rules you listed is this: + /testdir/ - /* The two methods differ in how they treat subdirectories in "testdir", though. ..wayne..
Dave.Turner@VerizonWireless.com
2004-Apr-22 15:44 UTC
exclude-from and include-from confusion
Thanks Wayne! That's doing the trick. I've been playing with combinations and am now getting what I expect. I think I'll be using something close to this for my exclude file to get what I want. + /testdir/* - /*/ Combining that with different modules will make it a much simpler task. Thanks! -----Original Message----- From: Wayne Davison [mailto:wayned@samba.org] Sent: Wednesday, April 21, 2004 5:21 PM To: Dave.Turner@VerizonWireless.com Cc: rsync@lists.samba.org Subject: Re: exclude-from and include-from confusion On Wed, Apr 21, 2004 at 04:51:57PM -0400, Dave.Turner@VerizonWireless.com wrote:> - Any directory or file listed in the exclude file will NOT be copied. > - Any directory of file listed in the include file WILL be copied nomatter> what is in the exclude file.Only if the include comes before the exclude in the list of all includes and excludes. If you reverse the order of your --exclude-from and --include-from options that would give the includes priority over the excludes. However, I'd recommend joining both files into a single file using explicit "+ " and "- " prefixes and switching over to just one --exclude-from=combo_file option. E.g.: + /testdir/ + /testdir/* - * (Note the explicit inclusion of the parent directory -- see the man page's discssion of how patterns are applied recursively.) Another solution that would work for the simple set of rules you listed is this: + /testdir/ - /* The two methods differ in how they treat subdirectories in "testdir", though. ..wayne..