为什么 "rsync --exclude-from" 不起作用
Why "rsync --exclude-from" ist not working
您好,我正在尝试将本地文件同步到远程服务器,文件已复制,但排除的文件不起作用。
我要排除的是一些文件,例如在一些不同的文件夹下:
htdocs/index.php
htdocs/.htaccess
htdocs/conf/Configuration.php
rsync -arvz --no-links --exclude-from 'excluded-files.txt' ./htdocs/ user@host:/var/www/test/htdocs/
怎么了?
除非您使用 -R
,否则排除模式与 from 目录的子目录相匹配。在您的情况下,您必须排除 index.php
而不是 htdocs/index.php
,但这可能会匹配太多此类文件。通过添加 -R
,您将测试的名称将是 ./htdocs/...
,因此模式将起作用,但您需要从目标目录中删除 htdocs
,即 user@host:/var/www/test/
您好,我正在尝试将本地文件同步到远程服务器,文件已复制,但排除的文件不起作用。
我要排除的是一些文件,例如在一些不同的文件夹下: htdocs/index.php htdocs/.htaccess htdocs/conf/Configuration.php
rsync -arvz --no-links --exclude-from 'excluded-files.txt' ./htdocs/ user@host:/var/www/test/htdocs/
怎么了?
除非您使用 -R
,否则排除模式与 from 目录的子目录相匹配。在您的情况下,您必须排除 index.php
而不是 htdocs/index.php
,但这可能会匹配太多此类文件。通过添加 -R
,您将测试的名称将是 ./htdocs/...
,因此模式将起作用,但您需要从目标目录中删除 htdocs
,即 user@host:/var/www/test/