rsync
rsync copied to clipboard
Avoid erroring out on an ignored file
If you have a remote directory with a file that is not readable to the rsync process; it rightly provides a non-zero exit code with a:
rsync: [sender] send_files failed to open ".../foo.txt": Permission denied (13)
However if you rsync this with a '--exclude ./foo.txt' it will still error out with that error (even though it correctly syncs the directories skipping that file.
Would be ideal if rsync did not even try to read/open the file at all. As it is know to be ignored already during directory listing buildup.
--exclude=PATTERN exclude files matching PATTERN
Does it work if you use --exclude foo.txt?
An example here
$ rsync -rv --progress rsync://remote-host/shared/test rsync
receiving incremental file list
created directory rsync
rsync: [sender] send_files failed to open "/test/foo.txt" (in shared): Permission denied (13)
test/
test/bar.txt
0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3)
sent 70 bytes received 270 bytes 680.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [generator=3.2.7]
$ rsync -rv --progress --exclude ./foo.txt rsync://remote-host/shared/test rsync
receiving incremental file list
rsync: [sender] send_files failed to open "/test/foo.txt" (in shared): Permission denied (13)
test/bar.txt
0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3)
sent 82 bytes received 267 bytes 698.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [generator=3.2.7]
$ rsync -rv --progress --exclude foo.txt rsync://remote-host/shared/test rsync
receiving incremental file list
test/bar.txt
0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/2)
sent 61 bytes received 126 bytes 374.00 bytes/sec
total size is 0 speedup is 0.00