6

I have a ton of filenames in Russian (and some Slovenian & Greek). To play them in my car the song titles must use only Western European characters.

  1. Is there a program that can do this file renaming?

  2. If not, is there a list of what letter(s) to use for each Cyrillic & Greek letter?

thanks - dave

Costique
  • 23,712
  • 4
  • 76
  • 79
David Thielen
  • 28,723
  • 34
  • 119
  • 193
  • 1
    Thank you - with the below I can write a C# program to do this real fast. I'll post a link to it once I get it done for others. – David Thielen Mar 03 '12 at 01:46

6 Answers6

4

Try a free programme called ReNamer by den4b, worked great for me.

http://www.den4b.com/?x=products

zakk
  • 41
  • 2
  • 2
    This has worked great for me too, it has a rule called `translit` which automatically converts Greek (and other alphabets) characters to their latin/english equivalent! This should be the accepted answer, in 2017 at least. – AsGoodAsItGets Jul 03 '17 at 17:01
3

I've made a shell script for this purpose, based on uconv from the icu-devtools package to perform the transliteration:

for f in "$@"
do
    if [ ! -f "$f" ]; then
        echo "$(basename $0) warn: this is not a regular file (skipped): $f" >&2
        continue
    fi

    NEWFILENAME="$(basename "$f")"
    NEWFILENAME="$( echo -n "$NEWFILENAME" | { transliterate || uconv -x 'Any-Latin;Latin-ASCII' || cat ; } )" # convert non-latin chars using my transliterate script OR uconv from the icu-devtools package
    NEWFILENAME="$( echo -n "$NEWFILENAME" | iconv -f UTF-8 -t ascii//TRANSLIT//IGNORE )"
    NEWFILENAME="$( echo -n "$NEWFILENAME" | tr -c '[A-Za-z0-9._\-]' '_' \
        | tr '\[\]' '_' \
        | sed -e 's/__*/_/g' \
        | sed -e 's/_\././g' )"
    # TODO: remove all dots except the last?
    
    if [ -f "$(basename $f)/$NEWFILENAME" ]; then
        echo "$(basename $0) warn: target filename already exists (skipped): $(basename $f)/$NEWFILENAME" >&2
        continue
    fi
    if [ "$(basename $f)" != "$NEWFILENAME" ]; then
        echo "\`$f' -> \`$NEWFILENAME'"
        mv -i "$f" "$NEWFILENAME"
    fi
done
eadmaster
  • 1,347
  • 13
  • 23
2

Here is the improved python script, which renames file to latin and removes old ones, plus it replaces all spaces with underscore character.

https://gist.github.com/braman/a8504c15ca537ea49c6a

2

This is a Russian transliteration table:

If you have python installed, you can use this script:

It seems to do a pretty good job and also you can change it to your needs. It did not work out of the box for me, I had to remove the encode call from following two lines (line numbers given in front):

117 print fpath.encode('utf-8')
136 print 'Copying %s to %s' % (fpath.encode('utf-8'), new_fpath)

i.e. change to:

117 print fpath
136 print 'Copying %s to %s' % (fpath, new_fpath)

but then worked fine, example (assuming you put the script from the above with the changes given to the file in the same folder called transliterate.py and then chmod u+x transliterate.py to make it executable):

$ mkdir a
$ touch a/сказать
$ ./transliterate.py a
a/сказать
Copying a/сказать to a/skazat'

Hope this helps.

icyrock.com
  • 27,952
  • 4
  • 66
  • 85
1

David,

I'm not aware of any program that will do it automatically (although given the information below, I bet you could get a computer geek friend to do it for you in exchange for a pizza.) Actually, the program really wouldn't be that hard to write in Perl.

In any case, here is some information that would help you choose which letters to use for each Cyrillic, Slovene, and Greek letter.

http://en.wikipedia.org/wiki/Romanization_of_Russian

http://en.wikipedia.org/wiki/Slovene_alphabet

http://en.wikipedia.org/wiki/Romanization_of_Greek

Hope that helps a little bit!

Aaron Johnson
  • 795
  • 1
  • 8
  • 16
0

I also made simple shell script that does not depend on any 3rd party package than sed, but this should be installed by default on most of Linux distros.

By default it transliterate only Cyrillic, but you can easily expand it with Greek characters using above provided link to Wikipedia article - http://en.wikipedia.org/wiki/Romanization_of_Greek

stz184
  • 363
  • 3
  • 12