]> git.saurik.com Git - wxWidgets.git/commitdiff
Added utility to convert filenames to lower case
authorJulian Smart <julian@anthemion.co.uk>
Thu, 12 Sep 2002 20:11:31 +0000 (20:11 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 12 Sep 2002 20:11:31 +0000 (20:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/namedown [new file with mode: 0755]

diff --git a/distrib/msw/namedown b/distrib/msw/namedown
new file mode 100755 (executable)
index 0000000..4621413
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# To make this Bourne shell script operative apply once:
+#  chmod 700 namedown
+#  rehash
+
+case $# in
+
+  0)
+    echo
+    echo "====================================================="
+    echo "namedown, Convert file names to lower case and ; to ."
+    echo "By Hannu Hirvonen and Timo Salmi Sun 18-Mar-2001"
+    echo "http://www.uwasa.fi/~ts/ and http://www.uwasa.fi/~hh/"
+    echo "====================================================="
+    echo
+    echo "Usage: namedown [FILENAME(S)]"
+    echo
+    echo "Converts file names only.  Directory names are not affected"
+    echo
+    ;;
+
+  *)
+    for oldname in $*
+    do
+      newfile=`basename ${oldname} | tr '[A-Z;]' '[a-z.]'`
+      dirname=`dirname ${oldname}`
+      newname="${dirname}/${newfile}"
+      oldname="${dirname}/`basename ${oldname}`"
+#Don't convert a file into itself
+      if [ "${newname}" = "${oldname}" ]; then
+        echo > /dev/null
+#Don't convert directory names
+      elif [ -d "${oldname}" ]; then
+        mv "${oldname}" "${oldname}.bak" 
+        mv "${oldname}.bak" "${newname:-${oldname}}"
+        echo "Directory ${oldname} converted to directory ${newname:-${oldname}}"
+#        echo /dev/null
+#Don't convert if the file does not exist
+      elif [ ! -f "${oldname}" ]; then
+        echo > /dev/null
+#Don't overwrite existing files
+#      elif [ -f "${newname}" ]; then
+#        echo "${oldname} not converted, file ${newname} already exists" 2>&1
+#Don't move to subdirectories if they happen to exist
+      elif [ -d "${newname}" ]; then
+        echo "${oldname} not converted, directory ${newname} already exists" 2>&1
+#Do it
+      else
+        mv "${oldname}" "${oldname}.bak" 
+        mv "${oldname}.bak" "${newname:-${oldname}}"
+        echo "File ${oldname} converted to file ${newname:-${oldname}}"
+      fi
+   done
+    ;;
+esac
+
+