ccd*_*ies 6 rsync shell-script filenames
我使用 rsync 来备份我的网站文件,使用 --link-dest 从以前的 rsync 备份中复制。
rsync -zavx -e 'ssh -p22' \
--numeric-ids \
--delete -r \
--link-dest=../"$latest_backup" "$rhost:$rhost_source" "$local_dest";
Run Code Online (Sandbox Code Playgroud)
我注意到带有非 ascii 字符的文件看起来已经转换了它们的字符,因此 rsync 正在删除它们然后重新下载它们。
下面是一个例子:
deleting public_html/images/made/96096a4645d59a3e/Moulin_a?\#200_vent_Bourgogne_DBW1901_680_680_s_c1.jpg
public_html/images/made/96096a4645d59a3e/Moulin_à_vent_Bourgogne_DBW1901_1200_801_80.jpg
Run Code Online (Sandbox Code Playgroud)
是否可以阻止 rsync 转换字符?
需要使用--iconv。
从手册页https://linux.die.net/man/1/rsync
--iconv=CONVERT_SPEC
Rsync can convert filenames between character sets using this option.
Using a CONVERT_SPEC of lq.rq tells rsync to
look up the default character-set via the locale setting. Alternately,
you can fully specify what conversion to do by giving a local and a
remote charset separated by a comma in the order --iconv=LOCAL,REMOTE,
e.g. --iconv=utf8,iso88591. This order ensures that the option will
stay the same whether you're pushing or pulling files. Finally, you
can specify either --no-iconv or a CONVERT_SPEC of lq-rq to turn off
any conversion. The default setting of this option is site-specific,
and can also be affected via the RSYNC_ICONV environment variable.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1856 次 |
| 最近记录: |