iconv 批量修改文件编码

iconv_shell.sh

#!/bin/bash

if ["$#" != "2"];then
    echo "Usage: `basename $0` dir filter"
    exit
fi 

dir=$1
filter=$2
echo $1
for file in `find $dir -name "$2"`;do
    echo "$file"
    iconv -f gb18030 -t utf8 -o $file $file
done

 

use:

./iconv_shell.sh file_path *.html

 

你可能感兴趣的:(iconv 批量修改文件编码)