Exclusion of files in rsync with or without wildcards? - Networking

This is a discussion on Exclusion of files in rsync with or without wildcards? - Networking ; I want to exclude some files from being synced with rsync. I have to exclude them with the --exclude option but with or without wirldcards? In other words should I write: rsync .... --exclude=/home/mylog* .... or just: rsync .... --exclude=/home/mylog ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Exclusion of files in rsync with or without wildcards?

  1. Exclusion of files in rsync with or without wildcards?

    I want to exclude some files from being synced with rsync. I have to exclude them with
    the --exclude option but with or without wirldcards?

    In other words should I write:

    rsync .... --exclude=/home/mylog* ....

    or just:

    rsync .... --exclude=/home/mylog ....

    when I want to exclude all the files:

    /home/mylog05
    /home/mylog04
    /home/mylog03

    The manual for rsync does not give this information

    Matthew

  2. Re: Exclusion of files in rsync with or without wildcards?

    Matthew Lincoln wrote:

    > I want to exclude some files from being synced with rsync. I have to
    > exclude them with the --exclude option but with or without wildcards?
    >
    > In other words should I write:
    >
    > rsync .... --exclude=/home/mylog* ....
    >
    > or just:
    >
    > rsync .... --exclude=/home/mylog ....
    >
    > when I want to exclude all the files:
    >
    > /home/mylog05
    > /home/mylog04
    > /home/mylog03
    >
    > The manual for rsync does not give this information
    >
    > Matthew


    I'm making my way along the rsync learning curve too. I don't
    know the answer to your question, but why not try a dry run or
    two:

    rsync -n ...
    or
    rsync --dry-run ...



  3. Re: Exclusion of files in rsync with or without wildcards?

    In article <4837e872$0$6604$9b4e6d93@newsspool2.arcor-online.net>,
    Matthew Lincoln wrote:
    >
    >
    >I want to exclude some files from being synced with rsync. I have to
    >exclude them with
    >the --exclude option but with or without wirldcards?
    >
    >In other words should I write:
    >
    >rsync .... --exclude=/home/mylog* ....


    Use --exclude '/home/mylog*' ...
    You can have as many exclude clauses as you want.

    I agree, the man page isn't great.

    >
    >or just:
    >
    >rsync .... --exclude=/home/mylog ....
    >
    >when I want to exclude all the files:
    >
    >/home/mylog05
    >/home/mylog04
    >/home/mylog03
    >
    >The manual for rsync does not give this information
    >
    >Matthew




  4. Re: Exclusion of files in rsync with or without wildcards?

    Time Waster wrote:

    > Matthew Lincoln wrote:
    >
    > >In other words should I write:
    > >
    > >rsync .... --exclude=/home/mylog* ....

    >
    > Use --exclude '/home/mylog*' ...


    Correct, putting quotes around the name prevents the shell expanding the
    star into a list of files before rsync reads it. With the quotes, rsync
    sees the star and can apply that as a wildcard match itself.

    > You can have as many exclude clauses as you want.


    You can also put a file called .rsync-filter into the source directory
    and then you can use the -F option to rsync instead of listing the
    exclude rules on the command line every time. This is easier if you have
    to sync often, and you don't have to worry about the shell doing
    anything funny with wildcards.

    > I agree, the man page isn't great.


    It's very long and a little verbose, but not lacking in detail.

    --
    James Taylor

+ Reply to Thread