Hello. I have 1000+ files whoes filenames are encoded in GB18030 charset right now. But my current system locale is set to zh_CN.UTF-8 and I wish to keep my locale. Here comes the problem of renaming each of them.

The only way I think of is to write a script:

#!/bin/sh
# this is gb2utf.sh
mv "$*" "`echo $* | iconv -f GB18030 -t UTF-8 `"

And process these files:

$find /files_with_gb18030_filenames -print0 | xargs -n 1 -0 gb2utf.sh

Now, before I process any file, I know this is not recoverable operation, I wonder if anyone can see a mistakes in my code. And, is my way the best way? I think perhaps there are existing program/script to do this kind of job, only I didn't find it out.

Thank you.

--
[email protected] mailing list



Reply via email to