[Gllug] Changing case on filenames

Timothy Coggins tc at sonicated.com
Mon Mar 4 19:42:35 UTC 2002


On Mon, 2002-03-04 at 18:41, Dylan Brewis wrote: 

> 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!

I think there is a way to mount the partition in the specified case but
it is much easier (for me) to write you a one liner:

perl -e 'opendir THISDIR, "."; @files = grep !/^\.\.?$/, readdir
THISDIR; closedir THISDIR; foreach $file (@files){rename $file,
lc($file) };' 

An example is:

tc at masterplan:~/tmpp$ ls
UPPER  lower
tc at masterplan:~/tmpp$ perl -e 'opendir THISDIR, "."; @files = grep
!/^\.\.?$/, readdir THISDIR; closedir THISDIR; foreach $file
(@files){rename $file, lc($file) };'
tc at masterplan:~/tmpp$ ls
lower  upper
tc at masterplan:~/tmpp$

Good luck!

Tim


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




More information about the GLLUG mailing list