Para sincronizar arquivos, há rsync
, e tem uma opção --append
para "anexar dados a arquivos menores":
rsync --append /path/to/foo.txt /path/to/foo.txt
# ^- original ^- copy
Exemplo de execução
Cenário de teste copiado flagrantemente da resposta da steeldriver - adicionei as opções -P
e -v
para a saída detalhada.
$ dd if=/dev/urandom bs=1M iflag=fullblock count=60 of=origfile
60+0 records in
60+0 records out
62914560 bytes (63 MB, 60 MiB) copied, 0.328983 s, 191 MB/s
$ dd if=origfile bs=1M iflag=fullblock count=30 of=newfile
30+0 records in
30+0 records out
31457280 bytes (31 MB, 30 MiB) copied, 0.0292976 s, 1.1 GB/s
$ cmp origfile newfile
cmp: EOF on newfile
$ rsync -Pv --append origfile newfile
origfile
62,914,560 100% 365.47MB/s 0:00:00 (xfr#1, to-chk=0/1)
sent 31,465,039 bytes received 35 bytes 20,976,716.00 bytes/sec
total size is 62,914,560 speedup is 2.00
$ cmp origfile newfile
$