[Gllug] Changing case on filenames

Alain Williams addw at phcomp.co.uk
Mon Mar 4 20:24:33 UTC 2002


On Mon, Mar 04, 2002 at 06:41:09PM +0000, Dylan Brewis wrote:
> Hi guys
> 
> I've got about 1000 files copied from W9x which are variously in upper and 
> lower case. Is there an easy way to get them all lower case (shell scripts or 
> similar.) I've read thru the bash docs but to be honest they don't make much 
> sense!

In some file:
	#!/bin/ksh -u

	# All uppers assigned to newname will be converted to lowercase:
	typeset -l newname

	# OK, change the line below in an appropriate manner
	for oldname in *
	do	newname="$oldname"
		# If it is already lower case don't attempt a move:
		[[ $newname = $oldname ]] && continue

		mv "$oldname" "$newname"
	done

The above just typed in, not run/debugged.

Have fun.

-- 
Alain Williams

#include <std_disclaimer.h>

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list