[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: bash script


Vani R. typed:
> I have around 120 files in a directory whose names are in uppercase
> letters. I want to change all these filenames to lowercase letters. I
> can't change it manually. I want to write a script to do the same. How
> do i do that? I have .c and .h files in the directory.
> Eg: TEST.C has to be converted to test.c

Try this:

for i in *; do mv $i $(echo $i | tr '[:upper:]' '[:lower:]'); done


Mrinal Kalakrishnan <mrinal@xxxxxxxxx> http://mrinal.dhs.org/
Linux 2.4.1 || PGP:B1E86F5B || Mutt 1.3.15i (2001-02-12) || VIM 5.7 
"Problem solving under linux has never been the circus that it is under
(By Pete Ehlke in comp.unix.aix)