Copy Filenames – How to Copy Filenames with Special Characters to NTFS Volume

cpunicode

I'm trying to copy the Documents and Settings folder of a Windows XP system over to an NTFS external disk using a USB Live of Puppy Linux.

I encountered an encoding problem for namefiles in which the system doesn't recognize italian special characters (part of utf-8) so that using cp or the GUI file manager will bring the error invalid or incomplete multibyte or wide character.

How can I copy the files whose names include the special characters to the NTFS drive?

Best Answer

Are you sure the file names are valid on the NTFS filesystem?

Do you require that the file names stay the same?

If not, you could remove the "strange" characters to make your live easier:

There is a tool for that, detox.

You can check what would get renamed without changing the filenames first:

$ detox -n somedir/*

And then, actually do it:

$ detox somedir/*



Another approach is to mount the NTFS filesystem in a way that it cleans up ('sanitizes') the file names itself.

There is a mount option to enable this, windows_names:

From man ntfs-3g:

  windows_names
              This option prevents files, directories and extended  attributes
              to be created with a name not allowed by windows, either because
              it contains some not  allowed  character  (which  are  the  nine
              characters  "  * / : < > ? \ | and those whose code is less than
              0x20) or because the  last  character  is  a  space  or  a  dot.
              Existing such files can still be read (and renamed).
Related Question