View previous topic :: View next topic |
Author |
Message |
pa4wdh l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 16 Dec 2005 Posts: 913
|
Posted: Fri Feb 14, 2025 5:55 am Post subject: rsync to fat32: Filenames with illigal characters |
|
|
Hi All,
I'm trying to rsync some files from a linux filesystem to a USB flash drive which has to be fat32 formatted. For most files this works, but some filenames contain characters that are not allowed in fat32. Is there a way for rsync to translate those characters to others that are allowed on fat32?
I've found the iconv parameter for rsync, which seems to be able to do what i need, but i don't understand how i should use it.
Has anyone done anything similar to this?
Thanks in advance. _________________ The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world
My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Banana Moderator
![Moderator Moderator](/images/ranks/rank-mod.gif)
![](images/avatars/5204386264b863c6da7ffb.jpg)
Joined: 21 May 2004 Posts: 1893 Location: Germany
|
Posted: Fri Feb 14, 2025 6:47 am Post subject: |
|
|
From rsync man
Quote: | --iconv=CONVERT_SPEC
Rsync can convert filenames between character sets using this
option. Using a CONVERT_SPEC of "." 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 push-
ing or pulling files. |
So --iconv=utf8,iso88591 could help.
But it could be also a file system spec problem.
Read more here: https://medium.com/@pratikpanchal/rsync-between-ntfs-and-fat32-formatted-storage-devices-731ae4b011e2
Quote: | Since FAT32 uses a 2-second resolution, this should overcome this problem:
rsync --archive --no-p --no-g --no-o --modify-window=2 source destination |
_________________ Forum Guidelines
PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sMueggli Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 03 Sep 2022 Posts: 544
|
Posted: Fri Feb 14, 2025 5:04 pm Post subject: |
|
|
I do not think that rsync can change filenames on the fly.
The clean solution is to rename all files with illegal characters on both filesystems.
The other solution is to archive the source and rsync only the archive. But that is only a good solution if you do not need to access the files on the FAT-formatted partition.
I guess the illegal characters are all part of the ASCII table and are therefore not affected by any codepage conversion. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pa4wdh l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 16 Dec 2005 Posts: 913
|
Posted: Fri Feb 14, 2025 5:51 pm Post subject: |
|
|
Thanks for your answers.
Indeed, illegal characters include ?, which is plain ascii and would not be converted. In this case i do not want to modify the source as this is just a temporary solution. Unfortunately archiving is not an options for my use case.
Last resort would be to write a script to do this, but i hoped to prevent that ![Smile :)](images/smiles/icon_smile.gif) _________________ The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world
My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
grknight Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
Joined: 20 Feb 2015 Posts: 2017
|
Posted: Fri Feb 14, 2025 6:14 pm Post subject: |
|
|
Use tar and output to a valid file name on the USB device. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pa4wdh l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 16 Dec 2005 Posts: 913
|
Posted: Fri Feb 14, 2025 7:01 pm Post subject: |
|
|
What do you mean grknight? I've searched the manual but didn't find anything about changing filenames.
In the mean time i've written a basic script to copy the files with some translation, it works for now which is good enough ![Smile :)](images/smiles/icon_smile.gif) _________________ The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world
My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
grknight Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
Joined: 20 Feb 2015 Posts: 2017
|
Posted: Fri Feb 14, 2025 7:46 pm Post subject: |
|
|
pa4wdh wrote: | What do you mean grknight? I've searched the manual but didn't find anything about changing filenames.
In the mean time i've written a basic script to copy the files with some translation, it works for now which is good enough ![Smile :)](images/smiles/icon_smile.gif) |
A tar archive can include files which wouldn't natively support on a file system. Just name the new file something that can be transported and unarchive after. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|