Home Explore Blog CI



man-pages

37th chunk of `rsync.man`
4d861c3c05beb500be83072ab4c14897e15ce7e2198fc0f30000000100000fde
 change", or "uptodate".  Using --info=skip1  (which
              is also implied by 2 -v options) outputs the exists message with‐
              out the INFO suffix.

       --remove‐source‐files
              This tells rsync to remove from the sending side the files (mean‐
              ing  non‐directories)  that  are  a part of the transfer and have
              been successfully duplicated on the receiving side.

              Note that you should only use this option on  source  files  that
              are  quiescent.  If you are using this to move files that show up
              in a particular directory over to another host,  make  sure  that
              the finished files get renamed into the source directory, not di‐
              rectly  written  into it, so that rsync can’t possibly transfer a
              file that is not yet fully written.  If you can’t first write the
              files into a different directory, you should use a  naming  idiom
              that  lets  rsync  avoid transferring files that are not yet fin‐
              ished (e.g. name the file "foo.new" when it is written, rename it
              to "foo"  when  it  is  done,  and  then  use  the  option  --ex‐
              clude=’*.new’ for the rsync transfer).

              Starting with 3.1.0, rsync will skip the sender‐side removal (and
              output an error) if the file’s size or modify time has not stayed
              unchanged.

              Starting  with  3.2.6,  a  local  rsync copy will ensure that the
              sender does not remove a file the receiver just verified, such as
              when the user accidentally makes the source and  destination  di‐
              rectory the same path.

       --delete
              This  tells  rsync  to delete extraneous files from the receiving
              side (ones that aren’t on the sending side), but only for the di‐
              rectories that are being synchronized.  You must have asked rsync
              to send the whole directory (e.g. "dir" or "dir/") without  using
              a  wildcard for the directory’s contents (e.g. "dir/*") since the
              wildcard is expanded by the shell and rsync thus gets  a  request
              to  transfer  individual  files, not the files’ parent directory.
              Files that are excluded from the transfer are also excluded  from
              being deleted unless you use the --delete‐excluded option or mark
              the  rules  as  only  matching  on  the sending side (see the in‐
              clude/exclude modifiers in the FILTER RULES section).

              Prior to rsync 2.6.7, this option would  have  no  effect  unless
              --recursive  was  enabled.   Beginning with 2.6.7, deletions will
              also occur when --dirs (-d) is enabled, but only for  directories
              whose contents are being copied.

              This  option  can  be dangerous if used incorrectly! It is a very
              good idea to first try a run using the --dry‐run (-n)  option  to
              see what files are going to be deleted.

              If  the sending side detects any I/O errors, then the deletion of
              any files at the  destination  will  be  automatically  disabled.
              This is to prevent temporary filesystem failures (such as NFS er‐
              rors)  on  the  sending  side  from causing a massive deletion of
              files on the destination.  You can override this with  the  --ig‐
              nore‐errors option.

              The --delete option may be combined with one of the --delete‐WHEN
              options without conflict, as well as --delete‐excluded.  However,
              if  none  of  the --delete‐WHEN options are specified, rsync will
              choose the --delete‐during algorithm when talking to rsync  3.0.0
              or  newer,  or  the  --delete‐before algorithm when talking to an
              older rsync.  See also

Title: Rsync Options: Removing Source Files and Deleting Extraneous Files
Summary
This section elaborates on the '--remove-source-files' option, including cautions about its use and changes in behavior with newer rsync versions. It also details the '--delete' option, which removes extraneous files from the receiving side, emphasizing its potential dangers and the importance of using '--dry-run' for testing. It explains conditions under which deletion is disabled and how it interacts with other options like '--delete-excluded' and '--delete-WHEN'.