renamer script help..

Jonesy gmane at jonz.net
Mon Feb 22 18:13:15 UTC 2010


On Sun, 21 Feb 2010 22:29:05 -0500, James Michael Fultz wrote:
> * Johnny Rosenberg <gurus.knugum at gmail.com> [2010-02-21 16:47 +0100]:
>> 2010/2/21 Vadkan Jozsef <jozsi.avadkan at gmail.com>:
>> > The script:
>> > http://pastebin.ca/1804613
>> >
>> > but it's not working too well:
>> > http://pastebin.ca/1804612
>> >
>> > e.g.: the script makes "arviztur-ukorfurogep" from "árvízt??r??
>> > tükörfúrógép", when it should be: "arvizturo-tukorfurogep"
>> >
>> > Has someone a similar script, that works?
> [...]
>> So here's the whole script now:
>> #!/bin/bash
>> 
>> ## Usage e.g.: sh renamer.sh "/home/user/Desktop/somedir"
>> 
>> if [ "$1" == "" ]; then echo "error: no directory name given"; exit 1; fi
>> if ! cd "$1"; then echo "error: can't cd into dir"; exit 1; fi
>> 
>> function renamefiles {
>> 
>> rename -- 'y/A-Z/a-z/' *;
>> 
>> rename -- 's/á/a/g' *;
>> rename -- 's/í/i/g' *;
>> rename -- 's/??/u/g' *;

I don't believe this is going to work in a LANG=xx_XX.UTF-8 environment. 
I had to change all of my bash scripts that relied on file name encoding 
-- which I copied over to Ubuntu 9.10 from my previous workstation 
(Mandrake 10.2 / LANG=en_US.ISO8859-1) -- to Double Byte Encoding.

What is being used by the OP:
$ set | grep LANG

Jonesy
-- 
  Marvin L Jones    | jonz          | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
    * Killfiling google & XXXXbanter.com: jonz.net/ng.htm





More information about the ubuntu-users mailing list