Bash: ошибка rsync push_dir "<filename>": не каталог - PullRequest
0 голосов
/ 06 марта 2019

Как мне найти файлы, которые я хочу rsync:

$files=$(find /tmp -mtime -4 -name '*.abc' -type f 2>/dev/null)

$echo $files
$/tmp/file.abc /tmp/newfile.abc

Команда Rsync:

rsync -v -a --progress --stats --rsh="ssh -o StrictHostKeyChecking=no" --files-from=`echo $files` user@target_host:/tmp/

Ошибка, которую я вижу:

building file list ...
push_dir "/tmp/newfile.abc" failed: Not a directory
rsync error: errors selecting input/output files, dirs (code 3) at flist.c(1055)

Версия Rsync:

$rsync --version
rsync  version 2.6.2  protocol version 28
Copyright (C) 1996-2004 by Andrew Tridgell and others
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
          no IPv6, 32-bit system inums, 64-bit internal inums

Как мне выполнить rsync?

1 Ответ

1 голос
/ 08 марта 2019

"rsync --files-from = -" принимает трубопровод, если указан -, следовательно:

find /tmp -mtime -4 -name '*.abc' -type f 2>/dev/null | rsync -v -a --progress --stats --rsh="ssh -o StrictHostKeyChecking=no" --files-from=- user@target_host:/tmp/
...