[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Umlauts in filenames not visible on Solaris7-Partition



Turned out that the umlauts got converted to \201 (ü) \204 (ä) and \224 (ö) and I've finally found a solution in modifying the following script from the usenet. Be sure to make a testrun with the mv command commented out. The programm can have a few side-effects.

#!/bin/bash
# written by Kaz Kylheku <kaz@cafe.net>
# March 1996
# Vancouver, Canada
#
# requires GNU 'bash', GNU 'tr', and some sort of 'sed' program.
#
# Modified for the replacement of \224 \204 \201 characters in
# March 2003 by arthur_vd@gmx.net

function processfile()

{
        new_name="`echo -n $1 | tr '\224\204\201' 'oau'`"
        if [ "$new_name" != "$1" ] ; then
                while [ -e "$new_name" ] ; do
                        new_name="${new_name}."
                done
                echo changing \"$1\" to \"$new_name\" in `pwd`
                mv -- "$1" "$new_name"
        fi
}

function processdir()

{
        set -f
        local savepwd="$(pwd)"
        if cd "$1" ; then
                set +f
                for file in * ; do
                        set -f
                        if [ "$file" != "." -a "$file" != ".." ] ; then
                                if [ -L "$file" ] ; then
                                        echo "skipping symlink" $file in
`pwd`
                                elif [ -d "$file" ] ; then
                                        processdir "$file"
                                elif [ -f "$file" ] ; then
                                        processfile "$file"
                                fi
                        fi
                done
                cd "$savepwd"
        fi
}

allow_null_glob_expansion=1
glob_dot_filenames=1

if [ $# = 0 ] ; then
        echo "$0: specify a list of directories"
fi

while [ $# != 0 ] ; do
        processdir "$1"
        shift
done




Reply to: