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.
Note that I haven't actually WRITTEn such a shell function,... that is
left as an exercise for the reader ;^}
Fred
--
---- Fred Smith -- [EMAIL PROTECTED] ----------------------------
I can do all things through Christ
who strengthens me.
------------------------------ Philippians 4:13 -------------------------------
--
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.