Home Explore Blog CI



man-pages

46th chunk of `rsync.man`
a370cdafe81f28b921f64338a2c1295c5b200d5e233251120000000100000ff8
 are
              cleared before adding any further rules.

              If FILE is ’-’, the list will be read from standard input.

       --files‐from=FILE
              Using this option allows you to specify the exact list  of  files
              to  transfer (as read from the specified FILE or ’-’ for standard
              input).  It also tweaks the default behavior  of  rsync  to  make
              transferring just the specified files and directories easier:

              o      The --relative (-R) option is implied, which preserves the
                     path  information  that  is specified for each item in the
                     file (use --no‐relative or --no‐R if you want to turn that
                     off).

              o      The --dirs (-d) option is implied, which will  create  di‐
                     rectories  specified in the list on the destination rather
                     than noisily skipping them (use --no‐dirs or --no‐d if you
                     want to turn that off).

              o      The --archive (-a) option’s behavior does not imply  --re‐
                     cursive (-r), so specify it explicitly, if you want it.

              o      These  side‐effects  change the default state of rsync, so
                     the position of the --files‐from option  on  the  command‐
                     line  has no bearing on how other options are parsed (e.g.
                     -a works the same before or after  --files‐from,  as  does
                     --no‐R and all other options).

              The filenames that are read from the FILE are all relative to the
              source  dir -- any leading slashes are removed and no ".." refer‐
              ences are allowed to go higher than the source dir.  For example,
              take this command:

                  rsync ‐a ‐‐files‐from=/tmp/foo /usr remote:/backup

              If /tmp/foo contains the  string  "bin"  (or  even  "/bin"),  the
              /usr/bin  directory  will be created as /backup/bin on the remote
              host.  If it contains "bin/" (note the trailing slash), the imme‐
              diate contents of the directory would also be sent (without need‐
              ing to be explicitly mentioned in the file -- this began in  ver‐
              sion  2.6.4).   In both cases, if the -r option was enabled, that
              dir’s entire hierarchy would also be transferred  (keep  in  mind
              that -r needs to be specified explicitly with --files‐from, since
              it  is  not implied by -a.  Also note that the effect of the (en‐
              abled by default) -r option is to duplicate only  the  path  info
              that  is  read from the file -- it does not force the duplication
              of the source‐spec path (/usr in this case).

              In addition, the --files‐from file can be read  from  the  remote
              host  instead of the local host if you specify a "host:" in front
              of the file (the host must match one end of the transfer).  As  a
              short‐cut,  you can specify just a prefix of ":" to mean "use the
              remote end of the transfer".  For example:

                  rsync ‐a ‐‐files‐from=:/path/file‐list src:/ /tmp/copy

              This would copy all the files specified  in  the  /path/file‐list
              file that was located on the remote "src" host.

              If  the --iconv and --secluded‐args options are specified and the
              --files‐from filenames are being sent from one host  to  another,
              the  filenames will be translated from the sending host’s charset
              to the receiving host’s charset.

              NOTE: sorting the list of files in the --files‐from  input  helps
              rsync to be more efficient, as it will avoid re‐visiting the path
              elements  that are shared between adjacent entries.  If the input
              is not sorted, some

Title: Rsync Option: --files-from (Continued)
Summary
This section continues the explanation of the --files-from option. It highlights that --relative and --dirs are implied by default, while --recursive is not implied by --archive when using --files-from. The order of options doesn't affect parsing with --files-from. Filenames are relative to the source directory, and leading slashes or ".." references beyond the source are disallowed. Directories listed with a trailing slash have their contents transferred. The file list can be read from the remote host by prefixing the filename with "host:". If --iconv and --secluded-args are used, filenames are translated between host charsets during a remote --files-from operation. Sorting the input file list improves rsync's efficiency.