473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I change the extension of a lot of files?

Suppose I have a large number of files in a directory with the .txt extension.

How can I change the extension of all these to .c?

I KNOW THAT ' ren *.txt *.c ' works from command promt but it did't work from power shell and for terminal.

please help!
Aug 25 '12 #1
3 2465
rski
700 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. for i in *.txt; do mv $i  `echo "$i" | sed 's/\.txt$/.c/g'`; done;
  2.  
Aug 27 '12 #2
vakula
3
Expand|Select|Wrap|Line Numbers
  1. ls -1 *.txt | nawk '{p=$0;gsub("txt","c");system("mv "p" "$0);}'
taken from <link removed>
Dec 30 '12 #3
doesn't work for "mv *txt *.c"?
Jan 5 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jeff | last post by:
Hiya I just woundering how would I go about detecting addition, deletion or change to files in a folder? Ideally id like to look at a linux directory and say watch all its contents and then...
3
by: Jill | last post by:
I do not know if this is the right place to ask but what are .mspx files. for eg: www.microsoft.com/windowsserver2003/evaluation/ overview/technologies/default.mspx Thanks in advance for the...
0
by: Luis Esteban Valencia | last post by:
Hello I have an installer that ask for the sql server. username and password. My application has a classlibrary in that classlibrary is a file called app.xml which has the connection string that I...
0
by: keithb | last post by:
When I try making changes to aspx files in a SharePoint Windows Services web site, I get an error message saying that Visual Studio cannot open a SharePoint site. Is that true, if so, how can...
1
by: wincek | last post by:
Hi All, Below .css works with default.html without problem but when i use it in default.aspx, do nothing. When i use it in separate .css file, and link it to defaulat.aspx stiil do nothing....
1
by: prakashleo | last post by:
Hi ppl can any one tell me how to open the .fsi files
2
kamill
by: kamill | last post by:
Hello All I am using .inc file extension ( to include files ) but these files are treated as a text file by WAMP , how to configure my php.ini file to treat them as a php files. Thanks and Regards...
3
by: cheesecaker | last post by:
For some reason, when PHP starts, it doesn't want to load some extensions that I KNOW are there. Here's the startup log: Parent: Received restart signal -- Restarting the server. Child 5176:...
15
by: pdhb_1 | last post by:
I'm trying to run Apache2.2.6 with php. However, I keep getting a long list of error messages in the log file indicating that includes are failing. For example, "PHP Warning: PHP Startup:...
1
by: sandysharma | last post by:
how to write a script(batch file or dat file ) to change extension of files from .RPT to .html actually I also want to ftp file first form the unix server to the window ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.