I'm running a version 5 server and I have a few questions about cfdirectory.

I have a documents folder, and underneath that folder are several 
subfolders (forms, pricelists, systems), each with a number of 
spreadsheets, docs, and pdf files in them. I'd like to crawl through 
each subfolder, save the record, then when done  join all the subfolder 
queries. From this one complete query, I could then resave an individual 
pdf, xls, and doc query using WHERE and LIKE..

That is my line of thinking, though there may be an easier way to 
achieve this after I explain my objective. Basically in the nutshell, I 
want one query with all pdfs, one query with all docs, and one query 
with all xls files (combined from the 3 subfolders).

Is there any easy way to achieve this (remember, CF5 server).???

I adopted a slightly easier approach to solving the issue mentioned 
above, like so (I hardcoded catlist).

The query
-----------------
<cfset catList = "pricelists,systems,forms" />
<cfloop index="category" list="#catList#">
   <cfdirectory
     name="GetFileSet"
     action="list"
     directory="#documentDir##category#"
     sort="name ASC">
   <cfquery dbtype="query" name="get#category#FileSet">
     SELECT             *
     FROM               GetFileSet
     WHERE              name NOT LIKE '~%'
   </cfquery>
</cfloop>

the display
--------------------

<h1><cfoutput>#pageTitle#</cfoutput></h1>

<cfloop index="category" list="#catList#">
<table class="display" cellpadding="0" style="margin-top:5px;">
<tr class="title">
<td style="padding-left:6px">File Name</td>
<td>Type</td>
<td>Size</td>
<td>Date Modified</td>
<td>&nbsp;</td>
</tr>
<cfoutput><h2>#CapFirstTitle(category)# Category</h2></cfoutput>
<cfset thisrow = 1>
<cfoutput query="get#category#FileSet">
<cfif name NEQ "." AND name NEQ "..">
<cfset startpoint = Len(name) - 3 />
<cfset strippedname = RemoveChars(name,startpoint,4) />
<tr bgcolor="###IIf(thisrow Mod 2, DE('EFEFEF'), DE('FFFFFF'))#">
<td class="docname">#CapFirstTitle(replace(listFirst(strippedname), "_", 
" ", "ALL"))#</td>
<td class="doctype">#right(name, 3)#</td>
<td 
class="docsize">#Numberformat(int(evaluate(ceiling(size/1024))),",")# 
kb</td>
<td style="docdate">#dateformat(DateLastModified)#</td>
<td class="docview"><a href="#documentHttp##category#/#name#">view</a></td>
</tr>
<cfset thisrow = thisrow + 1>
</cfif>
</cfoutput>
</table>
</cfloop>

========================

This works fine, but unfortunately it displays by category (or folder 
name) rather than by document type, which is what I would prefer.

Incidentally, I am curious - is there any way of crawling through the 
base folder (documents), and adding the individual subfolders (presuming 
I don't know there names or how many) to a comma delimited list for 
looping, instead of me having to hardcore the names??

I tried using joins but it would only let me add 2 queries at a time, 
and this soon becomes a pain in the ass when you have more than the 2 
folders, so I quickly moved passed this option.

All help appreciated.
TIA

adieu
Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209948
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to