filtered --delete ? - Tools

This is a discussion on filtered --delete ? - Tools ; Is there any way of filtering which files --delete removes? ....something like a --delete-exclude=FILTER option or something equivalent? I want to do an rsync on multiple directories, however I only want one of these directories to have files deleted, or ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: filtered --delete ?

  1. filtered --delete ?


    Is there any way of filtering which files --delete removes?

    ....something like a --delete-exclude=FILTER option or something equivalent?

    I want to do an rsync on multiple directories, however I only want one of
    these directories to have files deleted, or I only want certain specific
    files deleted, not all of them - is this possible?

    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


  2. Re: filtered --delete ?

    On Monday 23 June 2008 11:55:59 pm Matt McCutchen wrote:
    > On Mon, 2008-06-23 at 15:05 +0000, Corey wrote:
    > > Is there any way of filtering which files --delete removes?
    > >
    > > ...something like a --delete-exclude=FILTER option or something
    > > equivalent?

    >
    > This is exactly what "protect" filters (--filter='P pattern') do.
    >


    Ah - nice, I had overlooked that while perusing the man page; too much
    in a hurry for my own good!


    > Actually, by default, a plain exclude like --exclude=pattern or
    > --filter='- pattern' both "hides" matching source files from the file
    > list and "protects" matching destination files from deletion. With
    > --delete-excluded, plain excludes only hide and you have to use
    > --filter='P pattern' to protect.
    >
    > > I want to do an rsync on multiple directories, however I only want one of
    > > these directories to have files deleted, or I only want certain specific
    > > files deleted, not all of them - is this possible?

    >
    > Do something like --filter='R /delete/in/D/*' --filter='P *'. The "R"
    > is for "risk", the opposite of "protect". Files in directory D will
    > match the first filter and be considered for deletion, while all other
    > files will match the second and be protected from deletion.
    >


    Excellent; thanks a ton - that's exactly what I was looking for.


    Kind regards!

    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


  3. Re: filtered --delete ?

    On Mon, 2008-06-23 at 15:05 +0000, Corey wrote:
    > Is there any way of filtering which files --delete removes?
    >
    > ...something like a --delete-exclude=FILTER option or something equivalent?


    This is exactly what "protect" filters (--filter='P pattern') do.

    Actually, by default, a plain exclude like --exclude=pattern or
    --filter='- pattern' both "hides" matching source files from the file
    list and "protects" matching destination files from deletion. With
    --delete-excluded, plain excludes only hide and you have to use
    --filter='P pattern' to protect.

    > I want to do an rsync on multiple directories, however I only want one of
    > these directories to have files deleted, or I only want certain specific
    > files deleted, not all of them - is this possible?


    Do something like --filter='R /delete/in/D/*' --filter='P *'. The "R"
    is for "risk", the opposite of "protect". Files in directory D will
    match the first filter and be considered for deletion, while all other
    files will match the second and be protected from deletion.

    Matt

    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)

    iEYEABECAAYFAkhgOAwACgkQC+xSYN/RlfuD3ACgqQGqAx+kY8UMlBPpKxnQAr3x
    1g4An1YnftTwSCaDQMHZfMz7VEwruOtJ
    =fJFM
    -----END PGP SIGNATURE-----


+ Reply to Thread