uppercase to lowercase

Tags
shell scripts

 
Thread Tools Search this Thread
# 1  
Old 01-02-2002
Error uppercase to lowercase

Greetings & Happy New Years To All!

A client of mine FTP'ed their files up to the server and it all ended up being in UPPERCASE when it all should be in lowercase. Is there a builtin command or a script anyone knows of that will automagically convert all files to lowercase?

Please advise asap if you know how...

Thanks!
# 2  
Old 01-02-2002
do you want to convert the file names or the contents of the file??
# 3  
Old 01-02-2002
just file names

Thanks for your reply...

I just want to convert the files names, the directories and all files in the subdirectories to lowercase. File names and directory names only. Not the contents of the files.

I can do the direcotries by hand if necessary as there are only 5 or so but all the darn file names somehow got converted to UPPERCASE by my client....

Thanks again!
# 4  
Old 01-03-2002
Try something like this:
Code:
#!/bin/sh
# Do the directories first, so that the
# path doesn't change
for each in `find . -type d`
do
newname=`echo $each | tr [A-Z] [a-z]`
mv $each $newname
done
# Now to the files...
for eachf in `find . -type f`
do
newnamef=`echo $eachf | tr [A-Z] [a-z]`
mv $eachf $newnamef
done

I tested this on my machine real quick, and it worked OK...

Hope this helps.

(By The Way, you'll get some errors from mv if the filename is already lowercase {I even got an error trying to move "." to "."} - you don't have to worry about those...)
# 5  
Old 01-03-2002
it worked!

Thanks it worked!

It justed needed a 'done' statment at the end and it worked perfectly!

Thanks a million!

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Uppercase to lowercase ajayram Shell Programming and Scripting 6 11-01-2012 07:35 AM
Trying to find number of uppercase and lowercase letters. kasparov Shell Programming and Scripting 3 11-09-2011 07:22 PM
Convert lowercase to uppercase swikar Shell Programming and Scripting 1 05-16-2011 04:04 AM
Uppercase to lowercase and vice versa jacky29 Shell Programming and Scripting 5 03-28-2011 05:33 AM
Change Uppercase to Lowercase with some exceptions kcgb20 UNIX for Dummies Questions & Answers 3 06-10-2010 03:40 PM
Uppercase/lowercase comparison of one character per line with awk?? ivpz Shell Programming and Scripting 10 01-08-2010 08:22 AM
UPPERCASE to lowercase temhem UNIX for Dummies Questions & Answers 3 11-18-2009 11:15 AM
Unix: lowercase to uppercase chilli1988 UNIX Desktop Questions & Answers 6 06-10-2009 04:29 PM
sed help to convert from lowercase to uppercase and vice versa! salman4u Shell Programming and Scripting 6 03-21-2009 09:38 AM
indentation and lowercase to uppercase kratos. Shell Programming and Scripting 1 03-05-2009 01:25 PM
uppercase to lowercase ajit.yadav83 UNIX for Dummies Questions & Answers 4 10-16-2008 12:36 PM
Lowercase to Uppercase ggovotsis AIX 7 10-16-2008 11:07 AM
UPPERCASE to lowercase with no overwriting? lgd923 Shell Programming and Scripting 1 08-21-2008 09:13 AM
Need to change filenames in a particular directory from lowercase to UPPERCASE Duke_Lukem UNIX for Dummies Questions & Answers 7 01-07-2008 06:32 PM
How convert lowercase or uppercase Alex20 Shell Programming and Scripting 5 03-07-2005 07:07 AM