rsync 非 ASCII 文字

rsync 非 ASCII 文字

私はrsyncを使用してWebサイトファイルをバックアップし、--link-destを使用して以前のrsyncバックアップからコピーしています。

rsync -zavx -e 'ssh -p22' \
   --numeric-ids \
   --delete -r \
   --link-dest=../"$latest_backup" "$rhost:$rhost_source" "$local_dest";

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

rsyncが文字を変換するのを防ぐことはできますか?

ベストアンサー1

を使用する必要があります--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.

おすすめ記事