Difference between revisions of "Fix broken Umlauts in Filenames"

From S23Wiki
Jump to: navigation, search
(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\|...")
(No difference)

Revision as of 10:54, 15 May 2013

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]