Fix broken Umlauts in Filenames

From S23Wiki
Revision as of 10:54, 15 May 2013 by Took (Talk | contribs) (Created page with "Not really optimized yet... [pre] #/bin/bash for d in * do if [ -d $d ]; then cd "$d" for i in * do #x=$(echo $i | sed 's/\xc2\x91\|\xc2\x92\|\xc2\xa0\|...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Not really optimized yet...

[pre]

  1. /bin/bash

for d in *

 do
 if [ -d $d ]; then
   cd "$d"
   for i in *
   do
     #x=$(echo $i | sed 's/\xc2\x91\|\xc2\x92\|\xc2\xa0\|\xe2\x80\x8e//g' | sed 's/ü/ue/g' | sed 's/[^a-z0-9_~\.-]/_/gi' )
     x=$(echo $i | iconv -f utf8 -t ascii//TRANSLIT -c)
     echo "$x"
     mv "$i" "$x"
   done
   cd ..
 fi

done [/pre]