在将windows上的jsp网页移植到linux环境中时,发现一个个的转换编码及修改默认编码类型太慢,写此脚本进行尝试文件遍历。
#!/bin/bash
SPATH="/root/cheng"
DIR=WebRoot
DPATH="/web"
find ${DIR} -type d -exec mkdir -pv ${DPATH}/{} \;
find ${DIR} -type f -exec iconv -f GBK -t UTF-8 {} -o ${DPATH/{} \;
echo "The file Next Listed is not a common file or directory ,please check."
find ${DIR} ! -type f -a ! -type d -ecec ls -l {} \;
find $DPATH -type f -exec sed -i -e 's/gb2312/UTF-8/g' -e 's/GB2312/UTF-8/g' {} \;
echo ' '
echo "All Done."
转载于:https://blog.51cto.com/linushai/1368746
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)