#!/bin/bash
echo "Start convert in .tmp files \n"
for file in *.php; do
iconv -f iso-8859-1 -t utf-8 "$file" -o "${file%.php}.tmp"
done
echo "Start backup \n"
for file in *.php; do
mv "$file" "${file%.php}.bak"
done
echo "Rename files \n"
for file in *.tmp; do
mv "$file" "${file%.tmp}.php"
done
In this snippet, first I convert files to new files with *.tmp extension, backup actual all *.php files to *.bak files and finally move tmp files to php files.
*.bak = original files with old encoding
*.bak = original files with old encoding
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.