Closed Thread Icon

Topic awaiting preservation: PHP: Parse directories & combine files... Pages that link to <a href="https://ozoneasylum.com/backlink?for=25784" title="Pages that link to Topic awaiting preservation: PHP: Parse directories &amp;amp; combine files..." rel="nofollow" >Topic awaiting preservation: PHP: Parse directories &amp; combine files...\

 
Author Thread
DaveFA
Nervous Wreck (II) Inmate

From: USA
Insane since: Feb 2004

posted posted 05-16-2005 23:11

Howdy,

I've got a friend who's running a blog off using blogger, and he's taken advantage of the feature that, when archiving, creates a separate page for each entry. In the process, the archiving also creates two new directories. One for the year, and the other for the month. So, he's got the following directory structure:

--- /
------ /2004/
--------- /11/ [files - plain text]
--------- /12/ [files - plain text]

------ /2005/
--------- /01/ [files - plain text]
--------- /02/ [files - plain text]

What he wants to do is create a page in the root, that parses the /2004/ and /2005/ directories (and it's subdirectories), takes the text from the files in those directories, and adds them all to the new page in the root. Essentially, he wants to combine all of the files. And he wants to do it on the fly.

Now, I'm not all that wonderful at PHP. As I've said here before, if it's ASP, or even .NET, I could probably do it just fine, but PHP is an entirely different beast to me. If the information was databased, it'd be a simple retrievable script that goes into the DB, pulls out the data, dumps it, sort it by date, and voila, it's all done. Not the case here, obviously.

Can anyone help me write a script to do this? I would really, really appreciate it.

Thanks,

-----------------------------------
-Dave

Maker of stuff, user of things
-----------------------------------

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 05-17-2005 21:53

check out the comments of

php->readdir

there are a couple of ways to recursively read directories.

« BackwardsOnwards »

Show Forum Drop Down Menu