473,320 Members | 1,939 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,320 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 2462
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.