Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

How to list all articles in child subdirectories?

I want to write a CityDesk Script, that generates a list of all files, that are contained in direct child subdirectories of an article.

Assuming that I have the following articles,

products/summary
products/Product1/p1
products/Product2/p2
products/Product2/Details/d2

the script  should generate the following list for the products/summary article:

products/Product1/p1
products/Product2/p2

The list should not contain the products/Product2/Details/d2 article.

Many thanks for any hints.

Wilhelm Medetz
Friday, May 21, 2004

Wilhelm

Unless you want to get into naming folders:
(folder "products/Product1/p1") or
(folder "products/Product2/p2") not
(folder "products/Product2/Details/d2")
then, AFAIK, no you can't tell CD to start with this folder and get all the articles in all the child folders except child folders of the child folders.

You may want to look at the Keywords field. What you're asking for could be set up easily.
p1.keywords ~ "Product Summary - P1, ..."
p2.keywords ~ "Product Summary - P2, ..."
p3.keywords ~ "Product Summary - P3, ..."
d2.keywords ~ "Product Details - P2, ..."
Now find all the articles using (keywordContains "Product Summary")

HTH
PNII

Perpetual Newbie II
Friday, May 21, 2004

Actually, AFAIK, you can't even tell CD to start with this folder and get all the articles in all the child folders but it has been asked for. We're waiting on CD3 to see if it made the cut.
Missed mentioning that :)

Perpetual Newbie II
Friday, May 21, 2004

Moot, but your request asked for "list of all files" so:
Unless you want to get into naming folders:
(folder "products/Product1/p1") or
(folder "products/Product2/p2") not
(folder "products/Product2/Details/d2")

should be:
Unless you want to get into naming folders:
(folder "products/Product1/*") or
(folder "products/Product2/*") not
(folder "products/Product2/Details")

Perpetual Newbie II
Friday, May 21, 2004

Actually, AFAIK, you can't even tell CD to start with this folder and get all the articles in all the child folders but it has been asked for

Sure you can. There are a few variables you can use like Thisfolder or folder etc.

I don't have them in front of me right now ( I am remote) but you can do that with CS

John

John Cesta
Friday, June 04, 2004

This looks like what you want should be straightforward. Just use a script on your summary page that includes from the folders that you want. It would be something like this: (or(folder "Product1")(folder "Product2"))

That would tell it to include items from either of the two product directories.

Here's the documentation on this


To get articles from a subfolders, separate the folder names with slash (/) or backslash (\). For example, (folder "News/International"). For the top level folder, use "/".

Normally only articles directly under the named folder will be included. For example, if you have a News folder with two subfolders named International and Local, the condition (folder "News") will only get articles that are actually in the top folder directly, not the International and Local subfolders.

If you want to include all the articles inside a folder and all of its subfolders, add /* to the end of the foldername, For example, (folder "News/*") would return articles in News, News/International, and News/Local. This works for folders inside folders inside folders to any depth.

Jim
Wednesday, June 09, 2004

*  Recent Topics

*  Fog Creek Home