Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

looping through folders (including nested!)

Hey,

I'm running my blog off of Fog Creek and having a blast.  However, my main articles folder is getting pretty big and I'd love to peal articles off into sub folders.    However, that introduces a lot of manual work to manage archive scripts per sub folder

what I'd love to do is this:

- have a main "news" folder -- with just a handful of the most recent articles
- have a nested "old" folder -- \news\old with the remaining articles

and then allow my archive script to cycle through BOTH \News and \News\Old to generate the archive listing.  The key, of course, is that I want the archive script to be resilient in the face of me not religiously moving articles to the "old" folder.

perhaps a modification to the ForEach in "folder" to force recursion through sub folders?

vinod v
Friday, October 11, 2002

Have a look at my simple weblog template. The way it works is to only show articles that don't contain the keyword '(nonblogentry)'. That way, when you add a new entry it'll show up wherever it lives and if you add a something else, like an article, you put the '(nonblogentry)' keyword in and it won't show up on the list.

http://www.jbconners.com/backend/WeblogTemplate/ACityDeskWeblogTemplate.html

Hope that helps.

John C
Saturday, October 12, 2002

John C's method works very well.

I use John's template, turned upside down for this site:
http://tk-jk.net/euphonic/ and documented it a little here:
http://tk-jk.net/euphonic/doc/

Apart from creating the blog itself (in my case show listings) , each month I create one new archive article containing one script.  If I wanted, I could create these archive articles for the next 24 months or so and forget about them.

There have been a number of requests for more recursive-like scripting.

tk
Saturday, October 12, 2002

yep, I was thinking of that technique.  I was hoping to find a solution that didn't require work on a per-article basis.

e.g. display the first 10, sortdescend by .fileddate across ALL folders inside News.    then place the remaining articles, on an ongoing basis on the archive page.

vinod v
Tuesday, October 22, 2002

Well, if ALL folders are just News and News\Old you may use the "or" condition. If you have 10 subfolders you may loose your oversight (or(or(or(or(or(or(or(or(or(or())())())())())())())())())())...

Adriaan van den Brand
Thursday, October 24, 2002

Actually, you don't need all those 'or' statements - you can just say (or (cond1) (cond2) (cond3) (cond4) (cond5) (cond6)).

Darren Collins
Thursday, October 24, 2002

Just a thought, but instead of placing the old articles in another folder, just use a condition like (after today-90) in the new documents and use (before .... ) in the archive document. 

Each time you publish your website, the articles older than 90 days gets pushed to the archive section...

Jeff Kolker
Friday, November 01, 2002

*  Recent Topics

*  Fog Creek Home