<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>RE: [Cook] Enumerating leaf directories</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Normally within a cook file you have some kind of list of "project" files - a manifest as it were.<BR>
There are a number of ways to get that, using find, glob, in a file list. etc<BR>
> 1. I don't think find can do it unaided.<BR>
Assuming your files are .html then<BR>
project_files = [collect find . -type f -name [quote '*.html'] -print | sed -e [quote 's:^\./'::']];<BR>
<BR>
If your project is controlled using aegis then it is<BR>
project_files = [collect aelpf];<BR>
<BR>
But whatever lets just say you have it loaded somehow in a cook list -- project_files.<BR>
<BR>
So now the leaf directories you seek are given by:<BR>
leaf_directories = [stringset [dirname [project_files]]];<BR>
<BR>
But if you are wanting the leaf directories in order to find the project files ..... Normally you want to start with the list of files.<BR>
<BR>
<BR>
Jerry Pendergraft voice:651-523-6935<BR>
St.Jude Medical mobil:651-491-0163<BR>
Atrial Fibrillation Division email:jpendergraft@sjm.com<BR>
1350 Energy Lane<BR>
St.Paul, MN 55108<BR>
<BR>
-----Original Message-----<BR>
From: cook-users-bounces+jpendergraft=sjm.com@auug.org.au on behalf of Reuben Thomas<BR>
Sent: Fri 02-Mar-07 17:17<BR>
To: Cook users list<BR>
Subject: [Cook] Enumerating leaf directories<BR>
<BR>
Here I am, attacking my problem step by step!<BR>
<BR>
Step 1: I need to find my sources. They are, effectively, the leaf<BR>
directories of the tree. How best to enumerate them? Two hints:<BR>
<BR>
1. I don't think find can do it unaided.<BR>
<BR>
2. If you get a complete list of directories, and sort it, you can then use<BR>
the trick that a directory is a leaf if it is either the last in the list,<BR>
or is not a prefix of the following directory.<BR>
<BR>
In case it's not obvious: I know how to solve this problem (the above *is* a<BR>
solution), but I'm clueless how best to express it in Cook. In the worst<BR>
case, I can just write an external script to make the list, but I imagine<BR>
there's a better way to do it in Cook.<BR>
<BR>
--<BR>
<A HREF="http://rrt.sc3d.org/">http://rrt.sc3d.org/</A> | free, a. already paid for (Peyton Jones)<BR>
_______________________________________________<BR>
Cook-users mailing list<BR>
Cook-users@auug.org.au<BR>
<A HREF="http://www.auug.org.au/mailman/listinfo/cook-users">http://www.auug.org.au/mailman/listinfo/cook-users</A><BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>