Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-24-2002, 12:06 AM   #1
LQ Newbie
Registered: Nov 2001
Distribution: redhat 7.3 (currently)
Posts: 9

Rep: Reputation: 0
basename counterpart?

I'm trying to change a relatively large group of files' extensions. I can remove the current extensions with basename I think, but I need a counterpart to add the correct extension.
Old 08-24-2002, 07:11 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
One way to do this:

Change to the directory where your to-be-renamed files are, and enter (in bash):
for i in *.$OLDEXT ; do mv "$i" "${i%.*}.$NEWEXT" ; done
Where you should change the extensions ("cc" and "cpp") to your own needs of course.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dirname basename; how to capture extensions from bash? carl0ski Linux - General 2 07-22-2005 08:26 AM
Invert to Basename strip filename carl0ski Programming 2 07-03-2005 03:36 AM
ar counterpart for dynamic share libraries ? colmmagoo Linux - Software 0 08-06-2004 03:36 PM
BASH scripting problem, spaces in filenames / using basename textures Programming 24 11-16-2003 02:41 AM
any counterpart of mke2fs for cramfs aditya Linux - General 1 09-10-2002 06:02 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration