Home Explore Blog CI



man-pages

44th chunk of `rsync.man`
04a00ba6caee74fb5469e620495238371038b0d86e8230630000000100000ff3
 determine if a file should be ig‐
              nored.

              The exclude list is initialized to exclude  the  following  items
              (these  initial  items are marked as perishable -- see the FILTER
              RULES section):

                  RCS SCCS CVS CVS.adm RCSLOG cvslog.*  tags  TAGS  .make.state
                  .nse_depinfo  *~  #*  .#*  ,* _$* *$ *.old *.bak *.BAK *.orig
                  *.rej .del‐* *.a *.olb *.o *.obj *.so *.exe  *.Z  *.elc  *.ln
                  core .svn/ .git/ .hg/ .bzr/

              then,  files  listed  in a $HOME/.cvsignore are added to the list
              and any files listed in the CVSIGNORE environment  variable  (all
              cvsignore names are delimited by whitespace).

              Finally,  any file is ignored if it is in the same directory as a
              .cvsignore file and matches one of the patterns  listed  therein.
              Unlike  rsync’s filter/exclude files, these patterns are split on
              whitespace.  See the cvs(1) manual for more information.

              If you’re combining -C with your own --filter rules,  you  should
              note  that these CVS excludes are appended at the end of your own
              rules, regardless of where the -C was placed on the command‐line.
              This makes them a lower priority than any rules you specified ex‐
              plicitly.  If you want to control where these  CVS  excludes  get
              inserted into your filter rules, you should omit the -C as a com‐
              mand‐line  option and use a combination of --filter=:C and --fil‐
              ter=-C (either on your command‐line or by putting  the  ":C"  and
              "-C"  rules into a filter file with your other rules).  The first
              option turns on the per‐directory  scanning  for  the  .cvsignore
              file.   The  second  option does a one‐time import of the CVS ex‐
              cludes mentioned above.

       --filter=RULE, -f
              This option allows you to add rules to selectively  exclude  cer‐
              tain  files  from  the  list of files to be transferred.  This is
              most useful in combination with a recursive transfer.

              You may use as many --filter options on the command line  as  you
              like  to  build  up  the list of files to exclude.  If the filter
              contains whitespace, be sure to quote it so that the shell  gives
              the rule to rsync as a single argument.  The text below also men‐
              tions  that  you  can use an underscore to replace the space that
              separates a rule from its arg.

              See the FILTER RULES section for detailed information on this op‐
              tion.

       -F     The -F option is a shorthand for adding  two  --filter  rules  to
              your  command.  The first time it is used is a shorthand for this
              rule:

                  ‐‐filter=’dir‐merge /.rsync‐filter’

              This tells rsync to look for  per‐directory  .rsync‐filter  files
              that  have  been  sprinkled  through  the hierarchy and use their
              rules to filter the files in the transfer.  If -F is repeated, it
              is a shorthand for this rule:

                  ‐‐filter=’exclude .rsync‐filter’

              This filters out the  .rsync‐filter  files  themselves  from  the
              transfer.

              See  the  FILTER  RULES  section  for detailed information on how
              these options work.

       --exclude=PATTERN
              This option is a simplified form  of  the  --filter  option  that
              specifies  an exclude rule and does not allow the full rule‐pars‐
              ing syntax of normal filter rules.  This is equivalent to  speci‐
              fying -f’- PATTERN’.

              See the FILTER RULES section for detailed information on this op‐
              tion.

       --exclude‐from=FILE

Title: Rsync Filtering Options: --filter, -F, --exclude, --exclude-from
Summary
This section details rsync's filtering options, expanding on the previous chunk's --cvs-exclude option. It describes how to use --filter to selectively exclude files using various rules, including the use of per-directory .rsync-filter files using the -F shorthand. It also covers --exclude, a simplified version of --filter, and hints at the upcoming --exclude-from option for reading exclude patterns from a file. The content emphasizes understanding the FILTER RULES section for in-depth usage.