[PLUG] Re: Converting Mixed-Case File Names
Wil Cooley
wcooley at nakedape.cc
Sun Jan 9 07:01:04 UTC 2005
On 2005-01-09, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> I've received a whole bunch of code from a Winduhs coder. File names are,
> literally, mixed cases. Some names are uppercase with uppercase extensions,
> some uppercase names with lowercase extensions. Others are every possible
> combination of cases.
Pretty straight-forward:
for FiLe in *; do
file=$(echo "${FiLe}"|tr '[:upper:]' '[:lower:]')
echo mv -i "${FiLe}" "${file}"
done
(Remove the 'echo' once you've checked that it works.)
It gets slightly more interesting if you have a lot of directories, but
not too much.
It doesn't matter whether the name or extension is the wrong case--as
far as a shell is concerned they're just parts of a string.
Wil
--
Wil Cooley wcooley at nakedape.cc
Naked Ape Consulting http://nakedape.cc
* * * * Linux, UNIX, Networking and Security Solutions * * * *
More information about the PLUG
mailing list