Results 1 to 2 of 2

Thread: understanding rsync, --relative, --dirs

  1. #1
    Join Date
    Jun 2008
    Brisbane, Australia

    Default understanding rsync, --relative, --dirs

    I'm confused about something regarding rsync. I am moving some videos from PC1 to PC2 over the 'net using --files-from=FILENAME.

    What I don't get, is the difference between --relative and --dirs options (those are enabled when --files-from is used).

    This is what I believe to be true:
    --dirs lets rsync travel through directories WITHOUT recursive copying of directory contents. Without it, rsync will just IGNORE directories.
    --relative sends (to the receiving end) the PATH of the files (like /my/path/foo/bar.gz) if the path is specified on the command line (or inside FILENAME with --files-from option)

    • Which one will CREATE the new directories on the receiving side, --dirs or --relative?
    • --no-dirs will prevent rsync from looking inside directories? This would mean that if I had a list of files in FILENAME, including some relative path names like "./.mozilla" it would completely skip over them?
    • --no-relative will omit the whole path to the file (except filename)? Does this mean that the directory will still be opened and file transfered, but directory-name NOT be sent to receiving side?. If --no-relative is set, and --dirs is set, will the directories still be created on the receiving side? What if two files with the same name on different directories exist on the SENDER and they are transfered via rsync with --no-relative and --dirs? Will it transfer them both, but overwrite the first?
    NVIDIA! Listen to your customers! We want Free drivers.
    Petition #1. Petition #2. Use your VOICE! Sign the petitions!

  2. #2
    Join Date
    Jun 2008
    Blog Entries

    Default Re: understanding rsync, --relative, --dirs

    I believe rsync will always create target directories as needed, regardless of --dirs or --relative.

    From reading the man page --no-dirs is actually to cancel --dirs. So --no-dirs will simply ignore directories instead of copying them (but not their contents without --recursive).

    --no-relative is also to cancel any implied --relative so the handling is that the last component of each specified path is transferred. You can see why --relative would be turned on by --from-file. Your hierarchy would get flattened if it were not the case.

    If the target file already exists then it gets updated (overwritten) unless one of the backup options is in place.

    The -v and -n options are useful to see what would happen without actually changing anything on the receiving side.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts