]> git.saurik.com Git - wxWidgets.git/blob - distrib/msw/namedown
BIG CHANGE: added parsing of base classes; now CompareClasses() is much smarter since...
[wxWidgets.git] / distrib / msw / namedown
1 #
2 # To make this Bourne shell script operative apply once:
3 # chmod 700 namedown
4 # rehash
5
6 case $# in
7
8 0)
9 echo
10 echo "====================================================="
11 echo "namedown, Convert file names to lower case and ; to ."
12 echo "By Hannu Hirvonen and Timo Salmi Sun 18-Mar-2001"
13 echo "http://www.uwasa.fi/~ts/ and http://www.uwasa.fi/~hh/"
14 echo "====================================================="
15 echo
16 echo "Usage: namedown [FILENAME(S)]"
17 echo
18 echo "Converts file names only. Directory names are not affected"
19 echo
20 ;;
21
22 *)
23 for oldname in $*
24 do
25 newfile=`basename ${oldname} | tr '[A-Z;]' '[a-z.]'`
26 dirname=`dirname ${oldname}`
27 newname="${dirname}/${newfile}"
28 oldname="${dirname}/`basename ${oldname}`"
29 #Don't convert a file into itself
30 if [ "${newname}" = "${oldname}" ]; then
31 echo > /dev/null
32 #Don't convert directory names
33 elif [ -d "${oldname}" ]; then
34 mv "${oldname}" "${oldname}.bak"
35 mv "${oldname}.bak" "${newname:-${oldname}}"
36 # echo "Directory ${oldname} converted to directory ${newname:-${oldname}}"
37 # echo /dev/null
38 #Don't convert if the file does not exist
39 elif [ ! -f "${oldname}" ]; then
40 echo > /dev/null
41 #Don't overwrite existing files
42 # elif [ -f "${newname}" ]; then
43 echo "${oldname} not converted, file ${newname} already exists" 2>&1
44 #Don't move to subdirectories if they happen to exist
45 elif [ -d "${newname}" ]; then
46 echo "${oldname} not converted, directory ${newname} already exists" 2>&1
47 #Do it
48 else
49 mv "${oldname}" "${oldname}.bak"
50 mv "${oldname}.bak" "${newname:-${oldname}}"
51 # echo "File ${oldname} converted to file ${newname:-${oldname}}"
52 fi
53 done
54 ;;
55 esac
56
57