3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by griswolf
0

Something similar to

for filename in *; do mv $filename `echo $filename | iconv  -f UTF8 -t ANSI`; done

Warning: the above will fail badly if the filenames contain spaces. Tweak accordingly. Test with echo instead of mv first.
PS: I am not sure that ANSI is a correct encoding name (isn't it ISO-8859-1?). In any case, see iconv --list output.

0

iconv seems not able to convert the file itself, which seems to tell, to keep the file name while converting is impossible....

0

It is always very good to have a backup in case something goes wrong, so

  1. make a new directory beside current one: mkdir ../something-or-other
  2. do the work with target ../something-or-other/$filename
  3. clean up: thisdir=$(pwd);cd ..; mv $thisdir $thisdir.back; mv something-or-other $thisdir; cd $thisdir

Beware that I did not test this code, so consider it pseudocode until proven otherwise.

The point is that now if your "ansi" encoded files aren't proper, the originals are still available in the .back directory, so you can easily undo the error, whatever it was.

Edited by griswolf: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.