将带有特殊字符的文件名复制到外部 ntfs 卷

maj*_*aja 3 cp unicode

我正在尝试Documents and Settings使用 Puppy Linux 的 USB Live 将 Windows XP 系统的文件夹复制到 NTFS 外部磁盘。

我遇到了名称文件的编码问题,其中系统无法识别意大利语特殊字符(utf-8 的一部分),因此使用cp或 GUI 文件管理器会带来错误invalid or incomplete multibyte or wide character

如何将名称包含特殊字符的文件复制到 NTFS 驱动器?

Vol*_*gel 8

您确定文件名在 NTFS 文件系统上有效吗?

您是否要求文件名保持不变?

如果没有,您可以删除“奇怪”字符以使您的生活更轻松:

有一个工具可以做到这一点detox

您可以在不更改文件名的情况下检查将重命名的内容:

$ detox -n somedir/*
Run Code Online (Sandbox Code Playgroud)

然后,实际操作:

$ detox somedir/*
Run Code Online (Sandbox Code Playgroud)



另一种方法是挂载 NTFS 文件系统,它可以自行清理(“清理”)文件名。

有一个安装选项可以启用此功能,windows_names

来自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).
Run Code Online (Sandbox Code Playgroud)