批量转换当前目录下所有文件的编码格式 GBK --> utf-8
#!/bin/bash
# Recursive file convertion GBK --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find . -type f |
# find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
echo " $file"
mv $file $file.icv
iconv -f GBK -t UTF-8 $file.icv > $file
rm -f $file.icv
done