-   Programming (
-   -   Change Case (

DavidPhillips 09-14-2002 08:48 PM

Change Case

I need to change a group of files names to all lower case.
I also need to change the contents of a group of text files to lower case.
I need to do it in all files under a given folder, in all subfolders.


neo77777 09-14-2002 11:00 PM

Look at tr, and speifically at perl.

DavidPhillips 09-14-2002 11:09 PM

ok thanks

TheLinuxDuck 09-18-2002 09:09 AM

This will do the same thing:

for i in `find . -type f`; do mv $i `echo "$i" | tr 'A-Z' 'a-z'`; done
It will complain about files whose names are already all lowercase, but it works recursively and such... just another option without having to shell to perl...

DavidPhillips 09-18-2002 10:37 AM

great thats what I was looking for


djionel82 04-02-2005 10:50 AM

case change ...
I am also interested in changing the case of some files in linux fc3
i tried the code like the above code like this:
as root,
I created a file named lowcase and I wrote:

for i in `find . -type f`; do mv $i `echo "$i" | tr 'A-Z' 'a-z'`; done
exit 0

then I used chmod u+x lowcase
and then I tried to use it like this:
./lowcase X
where X was the name of a file in the working directory

it didn't work :(
help me out pls, maybe I did smth wrong...
I am quite new at using linux ...

djionel82 04-02-2005 04:45 PM

i found out the problem
the solution is very simple yet so stupid ....
the ideea is that when I wrote

for i in 'find . -type f'
I used the ' character (nest to ENTER key) instead of the ` character (under ESC key)
stupid solution ...
then everything worked
sorry to bother you

All times are GMT -5. The time now is 01:36 AM.