日期:2014-05-16  浏览次数:20677 次

求iconv批处理脚本
比如把文件夹下所有文件都从gbk转码成utf8储存,最好能递归把所有子目录下的文件也储存。

------解决方案--------------------
#!/bin/bash
#Program:
# Convert encoding of given files from one encoding to another
#History:
#11/22/2009

#read -p "Please input a directory as absolute path: " dir
files=$(ls --format=single-column|grep -v 'iconv.sh')
for filename in $files
do
iconv -f big5 -t gb2312 ${filename} | \
iconv -f gb2312 -t utf8 -o ${filename}
done