我试图将多个rsync命令组合成一个命令。 目前我使用下面的命令:
/usr/bin/rsync --exclude-from=/directory/exclude.txt --delete --rsync-path "/usr/bin/sudo /usr/bin/rsync" -e 'ssh' -rtogpu /directory user@server:/directory
该命令使用不同的目录执行5次。 我试图将这5个命令组合成一个命令,使用--files-from=include.txt
和--files-from=include.txt
就像这样:
/usr/bin/rsync --delete --rsync-path "/usr/bin/sudo /usr/bin/rsync" -e 'ssh' -rtogpu --files-from=/directory/include user@server:/directory
不幸的是,这并没有做到这一点,是否有一个好的方法来做到这一点与rsync? 如果是这样,我将如何能够做到这一点?
只是要清楚,我需要同步目录的全部内容,而不仅仅是单个文件。
提前致谢!
编辑
我的包含文件是这样的:
/directory/lower-dir/even-lower-dir/ /directory/lower-dir/ /directory/lower-dir/even-lower-dir/lowest-dir/
我已经试过了,结尾没有尾随斜杠,因为Roomneybuild议,但没关系。
我不知道如何正确使用--include-from=include.txt
不适合你。 在您的include.txt文件中,首先确保它在您当前的目录中,或者使用绝对path。
在include.txt中,确保每个文件夹都有一个绝对path,没有结尾的斜杠。 此外,你可能想尝试没有--files-from=include.txt
命令,因为我不知道是否需要。 我希望这个能有一点帮助!