Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing file extensions

Status
Not open for further replies.

geezer34

Technical User
Mar 17, 2004
11
GB
Hi Guys

I have a load of file that have a .JPG extension and I need to convert them to .jpg.

Know I need to loop through the file but dont know how to change the file name. Heres my basic code to date:

foreach i [glob *.JPG] {

}

Hope you can give me some pointers.

 
I have just found that I can use

file rename $i $i.jpg

however this gives me something along the line of

test.JPG.jpg.

Any way that I can just end up with test.jpg??

Thanks
 
Code:
file rename $i [append [file tail $i] .jpg]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top