#!/usr/bin/rexx /** Klasordeki dosyalarin turkce harflerini kaldirip bunlara en yakin ingilizce haflerle degistirir. This program renames all files in the current directory so that none of them contain Turkish characters. Turgut Kalfaoglu turgut@kalfaoglu.com, 08/2012 **/ "rxqueue /clear" did=0 "ls|rxqueue" do while queued()>0 parse pull fn ofn=fn t=pos("++",fn) do while t>0 l=left(fn,t-1) r=substr(fn,t+2) fn=l"u"r t=pos("++",fn) end newfn="" wasdash=0 do i=1 to length(fn) t=substr(fn,i,1) did=0 if t="-" then do wasdash=1 iterate end if pos(t," QWERTYUIOPASDFGHJKLZXCVBNM_.1234567890qwertyuiopasdfghjklzxcvbnm")=0 then do tn=c2d(t) did=did+1 select when tn=231 Then t="C" when tn=43 Then t="" when tn=186 Then t="c" when tn=131 Then t="g" when tn=215 Then t="s" when tn=194 Then t="g" when tn=166 Then t="i" when tn=252 Then t="u" when tn=246 Then t="o" otherwise do say "character" t c2d(t) "is unknown." t="" end end end if did>0 then do newfn=newfn||t end else do if wasdash>0 then newfn=newfn'-'t else newfn=newfn||t end wasdash=0 end if ofn<>newfn then do say "old: " ofn " newfn:" newfn 'mv "./'ofn'" "./'newfn'"' end end