Black Eagle Team Minishell
Path:
/
home
/
c
/
c
/
p
/
ccpsafy
/
www
/
[
Home
]
File: scriptDeConversion.sh
#! /bin/bash #if [ -e "list.txt" ] #then rm list.txt #fi #if [ -e "SkippedFiles.txt" ] #then rm SkippedFiles.txt #fi #if [ -e "convertedFiles.txt" ] #then rm convertedFiles.txt #fi newCodageType="utf-8" find . -name "*.php" > list.txt while read filePath do currentCodageType=$(file -b --mime-encoding "$filePath") if [ "$currentCodageType" == "unknown-8bit" ] then echo -e "SKIPPED : Don't Try to convert $filePath because current codage type is $currentCodageType" echo "$filePath" >> SkippedFiles.txt else # echo -e "Try to convert $filePath ($currentCodageType to $newCodageType) ..." mv "$filePath" "$filePath.old" echo -e "iconv -sc -f $currentCodageType -t $newCodageType -o \"$filePath\" \"$filePath.old\"" | tee -a convertedFiles.txt iconv -sc -f $currentCodageType -t $newCodageType -o "$filePath" "$filePath.old" if [ -e "$filePath" ]; then rm "$filePath.old" fi fi done < list.txt
©
2020 Black Eagle Team