Change file encoding in linux with iconv

Loop recursively through all files in a directory matching a pattern and then change their encoding with iconv.
 

 bash | 
 
 copy code |
?

1
#!/bin/bash
2
3
4
find /Path/To/Files -name \*.xxx -type f | \
5
    (while read file; do
6
        iconv -f ISO-8859-1 -t UTF8 "$file" > "${file%.xxx}-utf8.xxx";
7