LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-08-2005, 12:38 PM   #1
latino
Member
 
Registered: Aug 2003
Location: Puerto Rico
Distribution: RHEL 5.5
Posts: 141

Rep: Reputation: 15
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


Last edited by latino; 07-08-2005 at 01:01 PM.
 
Old 07-09-2005, 03:25 AM   #2
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
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
 
  


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
rpm .hdr files creation singh_tarandeep Red Hat 1 05-06-2004 09:40 PM
creation Temporary files with ~ sign?? kushalkoolwal Linux - Newbie 1 03-10-2004 01:21 PM
Creation of files in /etc/sysconfig rajatgarg Linux - General 1 10-09-2003 11:10 AM
Stopping Creation of Swap Files SaTaN Linux - General 4 09-02-2003 09:59 PM
Comparing files on creation time StarTux Programming 2 08-29-2003 01:08 PM


All times are GMT -5. The time now is 10:47 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration