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’ (http://www.petitiononline.com/nvfoss/petition.html).
‘Petition #2’ (http://www.opentheblob.com/nvidia/index.php). Use your
VOICE! Sign the petitions!

felipe1982’s Profile: http://forums.opensuse.org/member.php?userid=1152
View this thread: http://forums.opensuse.org/showthread.php?t=407803

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.


ken_yap

ken_yap’s Profile: http://forums.opensuse.org/member.php?userid=221
View this thread: http://forums.opensuse.org/showthread.php?t=407803