renameing lowercase to UPPERCASE

randall at randallsquared.com randall at randallsquared.com
Sun Aug 18 03:35:04 CDT 2002


rod holcomb wrote:
> How do I  a rename files where the filename is a 8 digit hexadecimal
> number with lower case [a-f] to the same filename but using
> uppercase?  Note I have several hundred of these in a directory?
> 
> 
> Example:    1a2b3c4d
> Rename this to  1A2B3C4D
> 

If you have Python on the box, you can just do
$ python
>>> import os
>>> dirname = "."
>>> for entry in os.listdir(dirname):
...   os.rename(entry, entry.upper())

Of course, if you want to specify a directory other than the current
one, you'll want to make dirname something else.

-- 
Randall Randall <randall at randallsquared.com>
"[The] poetic justice of cause and effect compels
 respect, compassion." -- Faithless, God is a DJ.




More information about the Kclug mailing list