#!/bin/bash
showUsage()
{
echo "Usage: gbk2utf-8dir.sh [dir]"
exit 0
}
dir=$PWD
if [ $# -gt 1 ]
then
showUsage
fi
if [ $# -gt 0 ]
then
dir=$1
fi
rm -rf .utf
find $dir -type d -exec mkdir -p .utf/{} \;
find $dir -type f -print -exec iconv -f GBK -t UTF-8 {} -o .utf/{} \;