Home Explore Blog CI



man-pages

23th chunk of `rsync.man`
d3142fb64dac301c87c755beeaadf2f0beb7a201537452d10000000100000fea
 "dir/", etc.).  Without  this  op‐
              tion  or  the --recursive option, rsync will skip all directories
              it encounters (and output a message to that effect for each one).
              If you specify both --dirs  and  --recursive,  --recursive  takes
              precedence.

              The  --dirs  option  is implied by the --files‐from option or the
              --list‐only option (including an implied  --list‐only  usage)  if
              --recursive wasn’t specified (so that directories are seen in the
              listing).  Specify --no‐dirs (or --no‐d) if you want to turn this
              off.

              There  is also a backward‐compatibility helper option, --old‐dirs
              (--old‐d) that tells rsync to use a hack  of  -r --exclude=’/*/*’
              to  get an older rsync to list a single directory without recurs‐
              ing.

       --mkpath
              Create all missing path components of the destination path.

              By default, rsync allows only the final component of the destina‐
              tion path to not exist, which is an attempt to help you to  vali‐
              date  your destination path.  With this option, rsync creates all
              the   missing   destination‐path   components,   just    as    if
              mkdir -p $DEST_PATH had been run on the receiving side.

              When  specifying  a  destination path, including a trailing slash
              ensures that the whole path is treated as directory names  to  be
              created, even when the file list has a single item. See the COPY‐
              ING TO A DIFFERENT NAME section for full details on how rsync de‐
              cides  if a final destination‐path component should be created as
              a directory or not.

              If you would like the newly‐created destination dirs to match the
              dirs on the sending side, you should be using --relative (-R) in‐
              stead of --mkpath.  For instance, the following two commands  re‐
              sult  in  the  same destination tree, but only the second command
              ensures that the "some/extra/path" components match the  dirs  on
              the sending side:

                  rsync ‐ai ‐‐mkpath host:some/extra/path/*.c some/extra/path/
                  rsync ‐aiR host:some/extra/path/*.c ./

       --links, -l
              Add symlinks to the transferred files instead of noisily ignoring
              them  with  a "non‐regular file" warning for each symlink encoun‐
              tered.  You can alternately silence  the  warning  by  specifying
              --info=nonreg0.

              The  default  handling  of symlinks is to recreate each symlink’s
              unchanged value on the receiving side.

              See the SYMBOLIC LINKS section for multi‐option info.

       --copy‐links, -L
              The sender transforms each symlink encountered  in  the  transfer
              into  the  referent item, following the symlink chain to the file
              or directory that it references.  If a symlink chain  is  broken,
              an error is output and the file is dropped from the transfer.

              This  option supersedes any other options that affect symlinks in
              the transfer, since there are no symlinks left in the transfer.

              This option does not change the handling of existing symlinks  on
              the receiving side, unlike versions of rsync prior to 2.6.3 which
              had  the side‐effect of telling the receiving side to also follow
              symlinks.  A modern rsync won’t forward this option to  a  remote
              receiver  (since only the sender needs to know about it), so this
              caveat should only affect someone using  an  rsync  client  older
              than  2.6.7  (which is when -L stopped being forwarded to the re‐
              ceiver).

              See the --keep‐dirlinks

Title: Rsync: Dirs, Mkpath, Links, and Copy-Links Options Explained
Summary
This section elaborates on the '--dirs' option's behavior, noting its interaction with '--recursive', '--files-from', and '--list-only'. It also explains the '--mkpath' option for creating missing destination path components, contrasting it with '--relative' for matching source directory structures. Furthermore, it details the '--links' option for transferring symlinks and the '--copy-links' option for transforming symlinks into their referenced files or directories, superseding other symlink options and noting historical differences.