You shouldn't use ls
like that and a for
loop is not appropriate either. Also, the destination directory should be outside the source directory.
mkdir /path/to/destination
find . -type f -exec iconv -f iso-8859-1 -t utf-8 "{}" -o /path/to/destination/"{}" ;
No need for a loop. The -type f
option includes files and excludes directories.
Edit:
The OS X version of iconv
doesn't have the -o
option. Try this:
find . -type f -exec bash -c 'iconv -f iso-8859-1 -t utf-8 "{}" > /path/to/destination/"{}"' ;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…