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

Re: [LI] How to change the extension of many files at a time



Rakesh Tiwari forced the electrons to say:
> yes u can do that with the command 
> 
> # mv *.cc *.cpp <Enter>

Hi Rakesh,

Please test the solutions you propose before posting here. Do you think this
will work? For mv, if there are more that two command line arguments (apart
from the switches), then the last one has to be a directory.

One method is to run the script (in bash):

for i in *cc; do base=$(basename $i .cc); newname=${base}.cpp; mv $i $newname; done

Binand

> 
> > Hi everybody,
> > I am having many files of .cc extension. Now I want to change the
> > extension to .cpp. Can I do this at a time without going for each file.
> > TIA
> > Ajit 

-- 
#include <stdio.h>                                   | Binand Raj S.
char *p = "#include <stdio.h>%cchar *p = %c%s%c;     | This is a self-
int main(){printf(p,10,34,p,34,10);return 0;}%c";    | printing program.
int main(){printf(p,10,34,p,34,10);return 0;}        | Try it!!
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.