Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

osx change file encoding (iconv) recursive

I know I can convert a single file encoding under OSX using:

iconv -f ISO-8859-1 -t UTF-8 myfilename.xxx > myfilename-utf8.xxx

I have to convert a bunch of files with a specific extension, so I want to convert file encoding from ISO-8859-1 to UTF-8 for all *.ext files in folder /mydisk/myfolder

perhaps someobe know the syntax how to do this

thanks

ekke

like image 658
ekkescorner Avatar asked Jul 25 '09 12:07

ekkescorner


1 Answers

Adam' comment showed me the way how to resolve it, but this was the only syntax I made it work:

find /mydisk/myfolder -name \*.xxx -type f | \
    (while read file; do
        iconv -f ISO-8859-1 -t UTF-8 "$file" > "${file%.xxx}-utf8.xxx";
    done);

-i ... -o ... doesnt work, but >

thx again

ekke

like image 82
ekkescorner Avatar answered Sep 19 '22 20:09

ekkescorner