[RSYNC] Problème dans le nom des fichiers importés

Fermé
patrice86 Messages postés 1378 Date d'inscription dimanche 26 octobre 2008 Statut Membre Dernière intervention 26 novembre 2023 - 18 mai 2017 à 11:18
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 - 24 mai 2017 à 13:23
Bonjour,

Lorsque j'exécute une commande rsync entre deux serveur, le nom des fichiers qui contiennent des accents ou bien des caractères spéciaux (€, °, @...) sont mal importés.
rsync -esv ssh -avz -P --delete-after src/ dest/

Exemple: Menu Dégustation => Menu D?gustation
été => ?t?

Cela me pose problème car j'ai un script PHP qui va ensuite chercher le nom des fichiers avec les accents et les caractères spéciaux.
Comment je peux faire pour que ma commande importe les fichiers avec les accents sur le nom des fichiers.

Je ne peux pas modifier les fichiers et supprimer les accents. Il s'agit de données clients donc je ne peux pas me permettre d'effectuer cette modification.

Merci :)

2 réponses

barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 4 908
Modifié le 24 mai 2017 à 13:23
Essaie ta commande Rsync en ajoutant cette option :
--iconv=utf8

C'est tiré de man rsync :
 --iconv=CONVERT_SPEC Rsync can convert filenames between character sets using this option. Using a CONVERT_SPEC of (dq.(dq 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(cqre pushing or pulling files. Finally, you can specify either --no-iconv or a CONVERT_SPEC of (dq-(dq 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.

For a list of what charset names your local iconv library supports, you can run (dqiconv --list(dq.

If you specify the --protect-args option (-s), rsync will translate the filenames you specify on the command-line that are being sent to the remote host. See also the --files-from option.

Note that rsync does not do any conversion of names in filter files (including include/exclude files). It is up to you to ensure that you(cqre specifying matching rules that can match on both sides of the transfer. For instance, you can specify extra include/exclude rules if there are filename differences on the two sides that need to be accounted for.

When you pass an --iconv option to an rsync daemon that allows it, the daemon uses the charset specified in its (dqcharset(dq configuration parameter regardless of the remote charset you actually pass. Thus, you may feel free to specify just the local charset for a daemon transfer (e.g. --iconv=utf8).
1
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 4 908
18 mai 2017 à 17:36
Bonjour,

La seule solution que je vois est de créer une archive avec un nom normal, ça permettra de contourner le problème.
0
barnabe0057
20 mai 2017 à 13:32
patrice ?
0
patrice86 Messages postés 1378 Date d'inscription dimanche 26 octobre 2008 Statut Membre Dernière intervention 26 novembre 2023 125
24 mai 2017 à 09:58
Bonjour,

Désolé, pas eu le temps de me reconnecter.
Je ne peux pas créer cette archive justement, je n'ai pas la main sur les fichiers lorsqu'ils sont importés.

En fait, lors du rsync, il semble que les fichiers dispose bien des accents (enfin je crois) mais qu'ils ne sont pas bien encodé.
0