DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Change File Name From Upper To Lower Case
This script requires perl, and a modern shell with ls (this was written/tested using Bash). It also will not work recursively without some modifications.
for file in `ls -1|perl -ne 'print "$_" if (/[A-Z]/);'`
do
mv ${file} `echo ${file}|perl -ne 'chomp;print "$_" if (tr/A-Z/a-z/);'`;
done






Comments
Snippets Manager replied on Thu, 2006/03/23 - 10:31am
for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; doneif you have lower case files this script will put a warning for them stating target file is same, but it's just a warning, that would change all files to lowercase.Snippets Manager replied on Mon, 2006/01/23 - 12:40am