LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-20-2006, 04:12 AM   #1
christina_rules
LQ Newbie
 
Registered: May 2006
Posts: 25

Rep: Reputation: 15
renaming extensions


i am very new in linux and hoping that i am able to get help here...can i know when we can't rename extensions by simply typing mv *.cpp *.c?
 
Old 05-20-2006, 04:17 AM   #2
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
Not sure but I think you need to be more specific with that renaming. like "mv baa.cpp baa.c". I'm myself not that familiar with linux. Also, check file permissions.
 
Old 05-20-2006, 05:38 AM   #3
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 49
Quote:
Originally Posted by christina_rules
i am very new in linux and hoping that i am able to get help here...can i know when we can't rename extensions by simply typing mv *.cpp *.c?
No. "mv" moves a bunch of files to one destination, so if you tried to do that it would try to move all the *.cpp and all but the last of the *.c files into the last .c file, which is not what you want (and does not work). Try something like
Code:
rename .cpp .c *.cpp
 
Old 05-23-2006, 04:11 AM   #4
christina_rules
LQ Newbie
 
Registered: May 2006
Posts: 25

Original Poster
Rep: Reputation: 15
thank you for solving the problem.
but if you don't mind can you explain how the code works? like why there are 3 arguments?

Quote:
but the last of the *.c files into the last .c file, which is not what you want (and does not work).
and what does this mean?
 
Old 05-23-2006, 04:29 AM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 49
Quote:
Originally Posted by christina_rules
but if you don't mind can you explain how the code works? like why there are 3 arguments?
read "man rename"

Quote:
Originally Posted by christina_rules
and what does this mean?
So "mv" works like this: suppose you do "mv A B C D E F", it tries to move the 5 things (A B C D E) into the directory F. When you do "mv *.cpp *.c", the shell expands the wildcards, so it becomes something like "mv A.cpp B.cpp C.cpp D.c E.c F.c" for example. Then it tries to move the 5 things (A.cpp B.cpp C.cpp D.c E.c) into the directory "F.c". Which is not what you wanted.
 
Old 05-23-2006, 09:58 AM   #6
christina_rules
LQ Newbie
 
Registered: May 2006
Posts: 25

Original Poster
Rep: Reputation: 15
thank you so much...i understand it clearly now..i appreciate it
 
Old 05-23-2006, 10:04 AM   #7
christina_rules
LQ Newbie
 
Registered: May 2006
Posts: 25

Original Poster
Rep: Reputation: 15
thank you so much...i understand it clearly now..i appreciate it
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File renaming amushtaq Linux - Software 2 01-13-2006 06:40 AM
bash help, renaming file extensions trey85stang Linux - General 8 07-21-2005 05:51 PM
Renaming Folders Tr@ce Linux - Newbie 1 02-19-2005 03:08 PM
Need help with renaming jpgs joe_stevensen Programming 2 06-26-2004 05:29 AM
Renaming folder jeffpoulsen Linux - General 2 10-21-2002 02:54 PM


All times are GMT -5. The time now is 05:14 AM.

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