Hi!
On Thu, Sep 10, 1998 at 02:23:30PM +0200, Jo Even Skarstein wrote:
> so I wondered if
> anybody has written a utility to automatically convert filenames to
> lowercase. The best would be a small GEM-application that you can drag
> files/folders to.
If you have a decent setup with GNU textutils and /bin/sh (e.g.
K[GE]MD), you could use a little shell script for that:
-- snip --
#!/bin/sh
usage ()
{
echo Usage: `basename $0` [-r ] file... >&2
exit 2
}
if [ $# -lt 1 ]
then
usage
fi
if [ "$1" = "-r" ]
then
recursive=1
shift
if [ $# -lt 1 ]
then
usage
fi
else
recursive=0
fi
for i in "$@"
do
new=`echo $i | tr "[:upper:]" "[:lower:]"`
if [ "$new" != "$i" ]
then
echo $i "->" $new >&2
mv "$i" "$new"
fi
if [ $recursive = 1 -a -d "$new" ]
then
$0 -r "$new"/*
fi
done
-- snap --
Called wihout options, it just converts all filenames passed, with
option `-r' it resursively converts filenames in subdirectories, too
(but only non-hidden files, i.e. those not starting with a dot).
Hope this helps ... Oh, and use it at your own risk!
Ciao
Thomas
--
Thomas Binder (Gryf @ IRCNet) gryf@hrzpub.tu-darmstadt.de
PGP-key available on request! binder@rbg.informatik.tu-darmstadt.de
Attachment:
pgpkMjTkkasJ3.pgp
Description: PGP signature