Hot answers tagged

4

You've fallen into rsync's classical "trailing slash trap": If the source path does not end with a slash, rsync will copy the source directory. If you intend to copy the contents of the source directory, it needs to end with a slash. Let's look at an example, assuming you want to copy a file at /home/me/source/Electronica/music/Folder.jpg: rsync -a /home/...


3

rsync will report changes for permissions differences timestamp differences content (and filesize) differences In comments, @roaima pointed out that there is an option to give a summary of these changes, in the rsync manual page: -i, --itemize-changes output a change-summary for all updates You may find it useful, though the summary is terse and ...


2

To do nothing if the file already exists in the destination tree (regardless of any metadata), pass the option --ignore-existing to rsync. rsync -a --remove-source-files --ignore-existing /var/www/domain/media/ /var/www/domain/bak/


2

You're confusing rsync by including directories on the command line and in the file, and by having the wildcard. This may be more what you want: $ cat lists.txt text1.txt $ ls A text1.txt toskip.txt $ rsync -av --files-from=lists.txt A/ B/ building file list ... done created directory B text1.txt sent 89 bytes received 31 bytes 240.00 bytes/sec ...


2

The filesystem on Mac OS X (HFS+) does not support hard links to symbolic links: $ touch file $ ls -l file -rw-r--r-- 1 kk staff 0 Jun 17 18:35 file $ ln -s file slink $ ls -l file slink -rw-r--r-- 1 kk staff 0 Jun 17 18:35 file lrwxr-xr-x 1 kk staff 4 Jun 17 18:36 slink -> file The following would ordinarily create a hard link to a symbolic link, and ...


2

To answer the main question in short, rsync seems to write double the number of bytes, because it spawns two processes/threads to do the copy, and there's one stream data between the processes, and another from the receiving process to the target file. We can tell this by looking at the strace output in more detail, the process IDs in the beginning of the ...


1

Rsync synchronizes files unless it is able to decide that they're the same without comparing their contents. It might synchronize a file and realize that there aren't any differences, if it wasn't able to tell that the files are identical without checking the contents. By default, rsync decides that two files are identical (and thus skips reading their ...


1

One solution is to make a union mount of B and C with C as the write branch. Then the problem reduces to copying from A to B+C only files missing on B+C, which can be done with rsync -a --ignore-existing /A /B+C For the union mount, one possibility is unionfs-fuse. unionfs-fuse -o cow /C=RW:/B=RO /B+C Or unionfs: mount -t unionfs -o dirs=/C=rw:/B=ro ...


1

The usual method is (writing from memory): NEWBACKUP=`date +%s` # or some other format cp -al "$OLDBACKUP" "$NEWBACKUP" rsync -aH --delete "$SOURCE" "$NEWBACKUP" Check out Easy Automated Snapshot-Style Backups with Linux and Rsync There is also a --link-dest option to rsync that I've never investigated properly.


1

expect is written in the tcl language, so strings containing whitespace must be quoted with double-quotes " not single quotes '. So replace your spawn line with spawn rsync -arvz -e "ssh -p 1690" --protect-args --progress /home/pappu/ "backup@xx.xx.xx.xx:/volume1/56 - Backup Server/pappu" Also, as mentioned by @steeldriver, a carriage-return is written \...


1

It is not exactly "pipe", but you can basically tell scp to copy specific FD (which can be pipe) from your host to the other. Simple bash command like this: (scp does not work as it needs a size in advance): scp <(tar cz files to compress) host:/path/to/new.file but it can work with pure ssh: tar cz files to compress | ssh host "cat > /path/to/new....


1

You cannot make hardlinks to symbolic links (this is not a "limitation" of OS X). A hardlink is a reference to an inode, and a symbolic link is not an inode but only an entry in the directory with some additional information. You may be thinking of Windows, which has analogous features, which behave differently. rsync does have a --copy-links option which ...


1

Usually, cron sends the output of the jobs it runs to the relevant user; so -v is useful there because you get an email with the full output of the rsync command. On a correctly-configured system, even mail to root goes to the appropriate user. For this to work you need mail to be setup appropriately on the system running cron; that used to be common on ...


1

This command works for me, it gets sync with the live server and deletes the file which were deleted from the live server. rsync -av --delete /home/ar/avi/ /home/ar/red/


1

in case anyone finds rsync doesn't work (for reports.paypal.com in my case) I found the following script using expect works: #!/usr/bin/expect spawn sftp username@reports.paypal.com:/ppreports/outgoing expect "password:" send "XXXXXXXXXX\n" expect "sftp>" log_file -noappend RemoteFileList.txt send "ls -1\n" expect "sftp>" log_file send "!sed -i '' '/...


1

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh: rsync -avh --progress --remove-source-files /home/user/mystuff/* user@external.server:/home/user/backup find . -depth -type d -empty -delete I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a ...



Only top voted, non community-wiki answers of a minimum length are eligible