On Sun, 7 Dec 2003, jeff wrote:
> I downloaded an ebook today which has a problem. The filenames are all
> uppercase but the TOC page and the index.htm links are specifying that
> filename in lowercase, and with Linux being case sensitive obviously the
> file is not found. Is there an easy and quick way to change all the 150+
> filenames (they are all html and jpg files) in that directory from
> uppercase to lowercase?
I wrote a script called 'lc':
#!/bin/ksh
[ $# == 0 ] && {
echo "Usage: ${0##*/} filename [filename [...]]"
exit 1
}
while [ $# -gt 0 ] ; do
wholefilename="${1%/}"
if [ ! -e "$wholefilename" ] ; then
echo "$wholefilename: no such file."
else
dirname="${wholefilename%/*}"
[ "$dirname" == "$wholefilename" ] && dirname=.
filename="${wholefilename##*/}"
newfilename=$(echo "$filename" | tr A-Z a-z)
if [ "$newfilename" == "$filename" ] ; then
echo "$wholefilename: filename already lower case."
elif [ -e "$dirname/$newfilename" ] ; then
echo "$wholefilename: converted filename already exists."
else
mv --verbose -- "$dirname/$filename" "$dirname/$newfilename"
2>/dev/null || echo "$wholefilename: error renaming."
fi
fi
shift
done
http://24.94.123.66:81/cgi-bin/getscript?file=%2Fexport%2Fbin%2Flc
usage: "lc *"
-- -eben ebQenW1@EtaRmpTabYayU.rIr.OcoPm home.tampabay.rr.com/hactar A. A Top Poster B. Who's there? A. Knock-knock -- from bobward@xxx.com----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:25:44 EDT