LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   multiple files creation (https://www.linuxquestions.org/questions/programming-9/multiple-files-creation-341315/)

latino 07-08-2005 12:38 PM

multiple files creation
 
Hi:

Need help with this.

FIRST PART:
I have a BUNCH files under dirname:

2001.html
2002..html
.
.
.
2094.html


I need to create SAME file names but with extension PHP. So I have

2001.php
2002.php
.
.
.
2094.php

SECOND PART
Each of the php files will be the same (it is a short php) but this line will change:
include("http://1.1.1.1/dir/2001.html");

In summary the php files will be doing these includes.:

2001.php --> include -- 2001.html
..
..
2002.php --> include -- 2002.html

..
..
..
2094.php --> include -- 2094.html


Please note that I will be including the html files from part I.

¿The question How I can do this?

My setup is Linux Red Hat, PHP 5.04, Apache2. Thank in Advance

:confused: :study:

vladmihaisima 07-09-2005 03:25 AM

I think this bash script should do it

Code:

#!/bin/bash
for I in `ls *.html`; do echo include\("http://1.1.1.1/dir/$I"\)\; > $I.php; done
rename .html.php .php *.html.php



All times are GMT -5. The time now is 04:39 PM.