重命名可以做到这一点..
尝试类似
find dir -depth -exec rename -n 's/[^[:ascii:]]/_/g' {} \; | cat -v
Run Code Online (Sandbox Code Playgroud)
您可能需要 cat -v 来正确显示任何奇怪的字符,而不会让您的终端被搞砸。
如果打印出可接受的替换,请将 -n 更改为 -v。
也就是说,听起来你的文件系统上的字符集是错误的(mount -o utf8 ?),因为这种事情应该真的有效......
尝试挂载文件系统,并将 iocharset 选项设置为它使用的编码。
\n\n在man mount
“FAT 的安装选项”部分下:
iocharset=value\n Character set to use for converting between 8 bit characters and\n 16 bit Unicode characters. The default is iso8859-1. Long file\xe2\x80\x90\n names are stored on disk in Unicode format.\n
Run Code Online (Sandbox Code Playgroud)\n\n另请参阅“vfat 的安装选项”部分:
\n\n uni_xlate\n Translate unhandled Unicode characters to special escaped\n sequences. This lets you backup and restore filenames that are\n created with any Unicode characters. Without this option, a \'?\'\n is used when no translation is possible. The escape character is\n \':\' because it is otherwise illegal on the vfat filesystem. The\n escape sequence that gets used, where u is the unicode charac\xe2\x80\x90\n ter, is: \':\', (u & 0x3f), ((u>>6) & 0x3f), (u>>12).\n
Run Code Online (Sandbox Code Playgroud)\n\n和
\n\n utf8 UTF8 is the filesystem safe 8-bit encoding of Unicode that is\n used by the console. It can be be enabled for the filesystem\n with this option or disabled with utf8=0, utf8=no or utf8=false.\n If `uni_xlate\' gets set, UTF8 gets disabled.\n
Run Code Online (Sandbox Code Playgroud)\n\n编辑:
\n\n抱歉,那是 Linux,这是 BSD(来自man mount_msdosfs
:
-L locale\n Specify locale name used for file name conversions for DOS and\n Win\'95 names. By default ISO 8859-1 assumed as local character\n set.\n\n -D DOS_codepage\n Specify the MS-DOS code page (aka IBM/OEM code page) name used\n for file name conversions for DOS names.\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
7021 次 |
最近记录: |