Skip to content

Instantly share code, notes, and snippets.

@nuriyevn
Forked from akost/convert.sh
Last active October 29, 2016 13:07
Show Gist options
  • Save nuriyevn/98946bd41420969492cf61b9f8272e6b to your computer and use it in GitHub Desktop.
Save nuriyevn/98946bd41420969492cf61b9f8272e6b to your computer and use it in GitHub Desktop.
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> 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 ./ -name "*.sql" -o -name "*.vbs" -type f |
while read file
do
echo " $file"
mv $file $file.icv
iconv -f WINDOWS-1251 -t UTF-8 $file.icv > $file
rm -f $file.icv
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment