If I try: rsync -lptgoD -e "ssh -i /root/.ssh/rsync-key" --verbose --exclude="/*.*" --exclude="*.xml" --include="+ */Tariff/" 192.168.1.1:/home/e-smith/files/ibays/frogs/files/dbs/ rsync lists the correct files, but if I add the destination like this: rsync -lptgoD -e "ssh -i /root/.ssh/rsync-key" --verbose --exclude="/*.*" --exclude="*.xml" --include="+ */Tariff/" 192.168.1.1:/home/e-smith/files/ibays/frogs/files/dbs/ /home/e-smith/files/ibays/frogs/files/dbs/ Then we get: skipping directory /home/e-smith/files/ibays/yesbookit/files/dbs/. client: nothing to do: perhaps you need to specify some filenames or the --recursive option? -- View this message in context: http://www.nabble.com/RSYNC-tf4933830.html#a14122152 Sent from the Samba - rsync mailing list archive at Nabble.com.
On Sun, 2007-12-02 at 16:47 -0800, KJB1 wrote:> If I try: > > rsync -lptgoD -e "ssh -i /root/.ssh/rsync-key" --verbose --exclude="/*.*" > --exclude="*.xml" --include="+ */Tariff/" > 192.168.1.1:/home/e-smith/files/ibays/frogs/files/dbs/ > > rsync lists the correct files, but if I add the destination like this: > > rsync -lptgoD -e "ssh -i /root/.ssh/rsync-key" --verbose --exclude="/*.*" > --exclude="*.xml" --include="+ */Tariff/" > 192.168.1.1:/home/e-smith/files/ibays/frogs/files/dbs/ > /home/e-smith/files/ibays/frogs/files/dbs/ > > Then we get: > > skipping directory /home/e-smith/files/ibays/yesbookit/files/dbs/. > client: nothing to do: perhaps you need to specify some filenames or the > --recursive option?You need to pass --recursive to make rsync traverse the source directory and copy its contents. The first command worked because, in listings, rsync shows at least the top-level contents of the source directory regardless of whether you pass --recursive. Matt
On Mon, 2007-12-03 at 13:15 +1100, Kevin Johnson-Bade wrote:> Thanks Matt, I kind of realised it was because the destination had no > recursion, but adding recursion then changes the meaning of the > filtering.It would be more accurate to say that the filtering becomes relevant. Unless I am mistaken, the non-recursive listing would show only top-level directories inside DBS. I don't know how you would see the Tariff subdirectories included but not the other subdirectories.> IE I am trying to sync certain files from within a specific folder > (Tariff), within a folder structure, that is duplicated as multiple > trees in folders of different names within DBS/You do want to keep the individual Tariff folders separate, in the same arrangement as in the source, right? If you want to merge them into one, you would do something completely different.> It seems that when I turn recession on then I have to go through and > exclude all the holders in which we have no interest.Yes. To do this, add a rule like --exclude='/*/*'; put it after the --include="+ */Tariff/" rule so it has lower priority. Matt
On Sun, Dec 02, 2007 at 08:43:04PM -0500, Matt McCutchen wrote:> You need to pass --recursive to make rsync traverse the source directory > and copy its contents.Or use the --dirs option to copy a directory without recursion. If the source directory has a trailing slash, just its immediate contents will be copied. ..wayne..
On Tue, 2007-12-04 at 09:37 +1100, Kevin Johnson-Bade wrote:> There are some odd things with rsync where the first triggered rule > philosophy seems to break down, in that an exclude * will override a > preceding include whatever.Please keep discussion of rsync that may be useful to others on the list. What you are seeing is probably that, with --recursive, exclusion of a directory stops rsync from traversing it and noticing any included files within. The right way to think of "include" is "don't exclude"; rsync still has to get to the file. This is mentioned in the man page (search for the word "ineffectual"), but it still trips a lot of people up. Here are three ways you could fix the problem: 1. Add high-priority includes for the ancestors of the files/directories you want rsync to see. 2. Use a separate "find" command to make a list of the files/directories rsync should copy, and provide the list to rsync using --files-from . 3. The crude but easiest approach: upgrade to rsync 2.6.7 or newer, add a high-priority --include='*/', and pass --prune-empty-dirs. Unfortunately, this will lose empty subdirectories in the areas that you do want to copy. Matt