The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Lowercase to Uppercase ggovotsis AIX 7 10-16-2008 10:07 AM
only uppercase first character? fedora Shell Programming and Scripting 7 09-26-2008 08:12 PM
Need to change filenames in a particular directory from lowercase to UPPERCASE Duke_Lukem UNIX for Dummies Questions & Answers 7 01-07-2008 05:32 PM
How convert lowercase or uppercase Alex20 Shell Programming and Scripting 5 03-07-2005 06:07 AM
Converting to Uppercase dreams5617 Shell Programming and Scripting 3 11-12-2004 12:44 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-02-2002
Registered User
 

Join Date: Jan 2002
Posts: 3
Exclamation 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!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-02-2002
Registered User
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
do you want to convert the file names or the contents of the file??
Reply With Quote
  #3 (permalink)  
Old 01-02-2002
Registered User
 

Join Date: Jan 2002
Posts: 3
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!
Reply With Quote
  #4 (permalink)  
Old 01-03-2002
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
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...)
Reply With Quote
  #5 (permalink)  
Old 01-03-2002
Registered User
 

Join Date: Jan 2002
Posts: 3
it worked!

Thanks it worked!

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

Thanks a million!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 05:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66