Skip to content

Instantly share code, notes, and snippets.

@liuxd
Last active September 7, 2017 01:35
Show Gist options
  • Save liuxd/f66e98ba3b08c335c3ac4bf7ee0309a3 to your computer and use it in GitHub Desktop.
Save liuxd/f66e98ba3b08c335c3ac4bf7ee0309a3 to your computer and use it in GitHub Desktop.
[convert.sh] 将一个目录下所有文本文档转换为utf8编码。
#!/bin/bash
DIR=$1
find $DIR | while read f;do
if [ -d $f ];then
continue
fi
cat "$f" > "$f.txt"
iconv -f GB18030 -t UTF-8 "$f.txt" > "$f"
rm -f "$f.txt"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment