Added utility to convert filenames to lower case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8a646b6b9f
commit
d4f6a3a014
57
distrib/msw/namedown
Executable file
57
distrib/msw/namedown
Executable file
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user