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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mv command

Status
Not open for further replies.

NitzGuy

Programmer
Jun 9, 2003
28
CA
hi,
this is probably really simple, I have about 70 files with a .es extension and I want to change the extension to .4gl without changing the contents of the file.

I don't know if I can use
mv *.es *.4gl
or not

Can someone please help me.
Thanks
 
Move won't allow you to do that. You can either do one to one moves or multiple to directory moves. Multiples can't change the file name.

Being on linux you'll likely have the rename utility. You'd use it like:
Code:
rename .es .4gl *es
Hope the helps.
 
This should work (test it out on a couple files first though ;-))

Code:
for i in *.es; do
    mv "$i" `echo "$i" | sed -e 's/\.es/\.4gl/g'`;
done

--
JR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top