批量转文件编码 gb2312->utf-8

for file in `find . -type f -name "*.hpp"`; do
   mv "$file" "$file.old" && iconv -f GB2312 -t UTF-8 < "$file.old" > "$file" && rm -rf "$file.old"
done

 

 

参考:

https://stackoverflow.com/questions/17267226/batch-converting-file-encoding

 

find 多条件连接

https://unix.stackexchange.com/questions/50612/how-to-combine-2-name-conditions-in-find

posted @ 2021-01-05 13:38  wolbo  阅读(495)  评论(0编辑  收藏  举报