Rsync: diferència entre les revisions

De WikiMar
Salta a la navegació Salta a la cerca
Cap resum de modificació
Línia 12: Línia 12:
  --info=progress2
  --info=progress2


===Using paths that contain spaces===
-s, --protect-args
This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it). [...]
The alternative is to escape twice (using ' and \ ) the parameters.
http://askubuntu.com/questions/597605/rsync-over-ssh-path-with-spaces-does-not-work-with-quotes


===See if a file is tranferred what differs===
===See if a file is tranferred what differs===

Revisió del 16:02, 1 gen 2017

To avoid copying owner/group and permissions from a NTFS

rsync -a --no-o --no-g --no-p --delete -v --log-file=/tmp/rsync2.txt --stats --modify-window=2 --exclude ".encfs6.xml" --exclude "/\$RECYCLE.BIN" --exclude "/System Volume Information" /media/marti/W2000/ /media/W3000LUKS_ENC/


To show stats at the end

--stats

Give a nice overall percentage

--info=progress2


Using paths that contain spaces

-s, --protect-args

This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it). [...]

The alternative is to escape twice (using ' and \ ) the parameters.

http://askubuntu.com/questions/597605/rsync-over-ssh-path-with-spaces-does-not-work-with-quotes

See if a file is tranferred what differs

 --itemize-changes (also in the -vvv)

YXcstpoguax  path/to/file
|||||||||||
||||||||||╰- x: The extended attribute information changed
|||||||||╰-- a: The ACL information changed
||||||||╰--- u: The u slot is reserved for future use
|||||||╰---- g: Group is different
||||||╰----- o: Owner is different
|||||╰------ p: Permission are different
||||╰------- t: Modification time is different
|||╰-------- s: Size is different
||╰--------- c: Different checksum (for regular files), or
||              changed value (for symlinks, devices, and special files)
|╰---------- the file type:
|            f: for a file,
|            d: for a directory,
|            L: for a symlink,
|            D: for a device,
|            S: for a special file (e.g. named sockets and fifos)
╰----------- the type of update being done::
             <: file is being transferred to the remote host (sent)
             >: file is being transferred to the local host (received)
             c: local change/creation for the item, such as:
                - the creation of a directory
                - the changing of a symlink,
                - etc.
             h: the item is a hard link to another item (requires 
                --hard-links).
             .: the item is not being updated (though it might have
                attributes that are being modified)
             *: means that the rest of the itemized-output area contains
                a message (e.g. "deleting")


>f+++++++++ some/dir/new-file.txt
.f....og..x some/dir/existing-file-with-changed-owner-and-group.txt
.f........x some/dir/existing-file-with-changed-unnamed-attribute.txt
>f...p....x some/dir/existing-file-with-changed-permissions.txt
>f..t..g..x some/dir/existing-file-with-changed-time-and-group.txt
>f.s......x some/dir/existing-file-with-changed-size.txt
>f.st.....x some/dir/existing-file-with-changed-size-and-time-stamp.txt 
cd+++++++++ some/dir/new-directory/
.d....og... some/dir/existing-directory-with-changed-owner-and-group/
.d..t...... some/dir/existing-directory-with-different-time-stamp/

http://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs



Compare files by content

-c

By default rsync compares only size and mtime of the file. -c is slow but it ensures that the content is correct


To copy only the timestamps

--size-only --existing

--size-only forces rsync to compare using only the size (not also the time)

Without the --size-only, rsync will detect them as diferent files and transfer the file

To copy only the timestamps (slow)

-c --existing

-c forces rsync to compare files using checksums