Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Looping through folders


I cant find how to do this. infact not sure this is possible, can you confirm?

Simple i want to be able to look through my folders...and subfolders.


james mountain
Wednesday, August 4, 2004


Look under foreach in the help file. 

You can use /path/to/folder to get all the articles in that folder.  If you want all the articles in all the subdirectories of that folder add an asterick on the end (/path/to/folder/*).  If you only want certain subdirectories you will have to specify each one in loops of their own.

David Burch
Wednesday, August 4, 2004

BTW: you can only access articles in a loop, not images or other files.

David Burch
Wednesday, August 4, 2004

Do you mean that you want foreach with a folder conditional to recurse into sub-folders?  If so, I think all you need is /* after the folder name -- (don't have citydesk in front of me -- so this is from memory)

{$foreach i (folder "/folder/*")$}

gets folders and subfolders -- I apologize if the syntax is not exact.

Lou Franco
Wednesday, August 4, 2004

*  Recent Topics

*  Fog Creek Home