On 11/27/05, Phil Howard <[EMAIL PROTECTED]> wrote: > I was under the impression that --include and --exclude worked by matching > patterns in the order given, and whichever matched first, whether that was > an include or exclude determined the action for that file. I have a big > directory from which I am attempting to transfer selected files. I want > all files where the first level directory is anything, the second level > directory is "2005" and the third level is the file "07.tar.bz2". So I > started with these options (different tries on each line): > > --include '**/2005/07.tar.bz2' --exclude '**' > --include '**/2005/07.tar.bz2' --exclude '*' > --include '*/2005/07.tar.bz2' --exclude '**' > --include '*/2005/07.tar.bz2' --exclude '*' > > I also tried numerous other random variations. Either I get absolutely no > files at all matching, or I get everything in the entire directory tree to > match. > > I hope what I want is clear to you. How can I make it clear to rsync? > > I've had several other cases of this in the past, and stumbled on something > that worked without really understanding why. So I guess the explanations > in the man page just didn't really give me the correct understanding of how > this works. Maybe someone can try explaining in another way. > > -- > ----------------------------------------------------------------------------- > | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ | > | (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ | > -----------------------------------------------------------------------------
I think you are trying to include too many things in a single include/exclude statement. You need to break everything down to files, folders, and sets of files in a single folder. For example, if you want to transfer a file 3 directories deep, each parent directory needs to be included if there is a global exclude at the end of your statements. The following will probably give you what you want: --include "/*" (include all files at root of transfer) --include "/*/2005/" --include "/*/2005/07.tar.bz2" (include file 07.tar.bz2, you must also include the folder that contains the file because of the next statement) --exclude "*" (exclude everything not explicitly included) I haven't tested it, so YMMV. -- Aaron W Morris (decep) <[EMAIL PROTECTED]> -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html