Questions tagged [rsync]

Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon

Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.

Rsync website

1595 questions
40
votes
7 answers

Handling renamed files or directories in rsync

I am working on an rsync script for directory replication. I have it syncing only new and modified files or directories but I don't like the fact that it's copying renamed files or directories as a new file or directory, keeping the files not in…
jmituzas
  • 513
  • 1
  • 5
  • 12
37
votes
5 answers

rsync 'cannot delete non-empty directory' errors, even with --force option

When running this command: $ sudo rsync -r --delete --force --checksum --exclude=uploads /data/prep/* /data/app/ I'm getting the following output: cannot delete non-empty directory: html/js/ckeditor/_source/plugins/uicolor/yui cannot delete…
tommarshall
  • 473
  • 1
  • 4
  • 7
36
votes
4 answers

How to repeatedly call rsync until files are sucessfully transferred

I'm trying to syncronize files from a remote server that is not reliable, meaning the connection tends to fail "randomly" with rsync: connection unexpectedly closed Rsync is called with --partial, so I'd like to be able to call rsync in a loop…
Bruno Lopes
  • 615
  • 2
  • 6
  • 8
36
votes
2 answers

SCP transfer only modified files

I'm using below command to transfer files cross server scp -rc blowfish /source/directory/* username@domain.net:/destination/directory Is there a way to transfer only files modified files just like update command for cp?
Passionate Engineer
  • 553
  • 1
  • 7
  • 12
36
votes
3 answers

compare 2 directories and copy differences in a 3rd directory

Running ubuntu 12.04, I want to compare 2 directories, say folder1/ and folder2/ and copy any files that are different to folder3/. There are also nested files, so matching subdirectories should be copied as well Is there a single command that…
periklis
  • 421
  • 1
  • 4
  • 9
35
votes
2 answers

How do I set destination permissions with rsync (chown chmod)

I am trying to do a local rsync, from a mount point to a local folder. I need to set the owner, group, and permissions to specific settings. Here is what I am using: rsync -rtlv --chown=process:sambausers --chmod=D770,F770…
Roger Creasy
  • 861
  • 3
  • 11
  • 18
35
votes
2 answers

Using rsync's archive flag without copying symbolic links

As stated in rsync's man page, the -a (archive) switch is equivalent to -rlptgoD. However, I have a situation where I don't want symbolic links retained. Is there any way to keep using the -a switch and prevent copying of symbolic links? I could…
Hay
  • 473
  • 1
  • 4
  • 6
34
votes
7 answers

How can I use rsync with a FAT file system?

I would like to write a simple backup script that saves some data to a FAT drive. Should I reformat the drive and use a better file system or is it possible to use rsync with FAT? If so, what problems might I run into? Would performance be a lot…
Kim
  • 769
  • 1
  • 5
  • 12
33
votes
2 answers

Copy directory tree without empty directories?

I have the following tree # upper letters = directory # lower letters = files A |-- B |-- C |-- D |-- e <= file |-- F |-- G I need to copy this tree to another destination, recursively ignoring all the empty directories. So the…
Dane O'Connor
  • 1,269
  • 2
  • 15
  • 20
32
votes
9 answers

Best way to compare (diff) a full directory structure?

What's the best way to compare directory structures? I have a backup utility which uses rsync. I want to tell the exact differences (in terms of file sizes and last-changed dates) between the source and the backup. Something like: Local file …
Adam Matan
  • 13,194
  • 19
  • 55
  • 75
32
votes
6 answers

Using rsync from msysgit for binary files

I have three windows boxes that are connected to a linux box on my network in various ways (one's local to the network, one is a laptop and may or may not be local, and the other is my work desktop). I'm currently making use of git to syncronize…
Will Gant
  • 331
  • 1
  • 3
  • 3
32
votes
8 answers

Rsync seems incompatible with .bashrc (causes "is your shell clean?")

It turns out rsync can't work with a remote server which has a .bashrc file? At local client i got when run rsync: protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility…
Computist
  • 473
  • 1
  • 5
  • 7
31
votes
7 answers

rsync files to a kubernetes pod

I need to rsync a file tree to a specific pod in a kubernetes cluster. It seems it should be possible if only one can convince rsync that kubectl acts sort of like rsh. Something like: rsync --rsh='kubectl exec -i podname -- ' -r foo x:/tmp ...…
Bittrance
  • 3,070
  • 3
  • 24
  • 27
31
votes
3 answers

rsync won't delete files on destination

I am trying to mirror a directory that changes over time to another directory. My problem is that rsync is not deleting files on destination if they aren't existing in source directory anymore. Here is a demo script: #!/bin/sh set…
halp
  • 2,208
  • 1
  • 20
  • 13
30
votes
5 answers

Nice rsync on remote machine

When using rsync+ssh to access a remote machine, is there a way to "nice" the rsync process on the remote machine (to lower its priority)? Editing the question to clarify: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME…
mwalling
  • 532
  • 2
  • 5
  • 12