On Fri, 22 May 1998, Fred Smith wrote:
> On Fri, May 22, 1998 at 01:01:25PM +0100, Simon Liddington wrote:
> >
> > Can anyone think of an easy way of changing the case of the names of a
> > directory tree of files?
> >
> > Simon
>
> Within each directory the following will change all the names in that
> directory:
>
> for i in *
> do
> mv `echo $i | tr "[A-Z]" "[a-z]"`
> done
>
> But it also changes any subdirectories that live there, so if you don't want
> to do that you may need to do some checks for the type of the file before
> changing it.
>
> I don't know if shell functions can be recursive or not, but if they can
> you could wrap this inside such a function, include the test for file type
> (see "man test") and if it is a directory cd to it and invoke the shell
> function recursively instead of changing it.
for a recursive mv, why not use find:
find .|while true;do
read oldname
if [ z$oldname = z ];then
exit 0
else
echo $oldname `echo $oldname|tr '[A-Z]' '[a-z]'`
fi
done
---
Richard Lindner [EMAIL PROTECTED] Intrepid Adventurer
Oh! - What a Long Strange Trip it's been .... Ph:+61 (0)411 741 560
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.