Yes you can climb directory trees by calling cfdirectory recursivley.

like this....


custom tag, [dir.cfm]

<cfparam name="request.filelist"
default="#QueryNew('Filename,FileDate,Size')#">
<cfdirectory action="LIST" directory="#attributes.basedir#" name="list">
<cfloop query="list">
        <cfif type is "File" and right("#name#",4) is "#attributes.filter#">
        <cfscript>
                QueryAddRow(request.filelist);
        
QuerySetCell(request.filelist,"FileName","#attributes.basedir##name#");
        
QuerySetCell(request.filelist,"FileDate","#DateLastModified#");
                QuerySetCell(request.filelist,"Size","#Size#");
        </cfscript>
        <cfelse>
                <cfif NOT (name is "." or name is "..")>
                        <cf_dir basedir = "#attributes.basedir##name#\"
filter="#attributes.filter#">
                </cfif>
        </cfif>
</cfloop>



Call the tag like so...

<cf_dir basedir = "d:\" filter=".wma">


That should kick back a query obect (request.filelist) which contains all
wma files in the directory tree down form d:\

Try not to let it scan HUGE trees as it may take for ever.

HTH, Craig.

-----Original Message-----
From: Tyler Silcox [mailto:[EMAIL PROTECTED]]
Sent: 12 December 2001 13:09
To: CF-Talk
Subject: Re: Quick cfdirectory ?...


I set it up the same way as below with the if statement.  I was just looking
for a quick and (not-so) dirty solution, and I really don't know why they
are there in the first place.  Can you climb a directory tree with these or
what?  Thanks James and Lloyd...

Tyler

----- Original Message -----
From: "Lloyd Bayley" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 11, 2001 9:56 PM
Subject: Re: Quick cfdirectory ?...


I did it this way...

Set the query here...

<cfdirectory action="LIST" directory="d:\folder\subfolder"
name="Qry_Show_Folder">


Show the files without directories here...

<select name="Cmb_FolderView" size="9">
         <cfoutput query="Qry_Show_Folder">

                 <cfif #type# neq "Dir">
                         <option>
                                 #DateLastModified# - #name#<br>
                         </option>
                 </cfif>
         </cfoutput>
</select>


HTH,

Lloyd. :-)

------------------------

At 15:40 12/12/01 +1300, you wrote:
>At 03:01 PM 12/12/2001, you wrote:
> >Is it possible to keep the "Dir" Types out of my query for cfdirectory?
> >With a filter maybe?  This is what I got's:
> >
> ><cfdirectory name="myQueryName" action="LIST"
> >directory="#request.Path.FileDir#filez\">
> >
> >and it returns:
> >
> >".", "..", "file01", "file02", "file03", etc.  Can I throw a filter
> >attribute on the cfdirectory?  I can figure out how to make it return all
> >the *.wma files, but I can't figure out how to just give me back
Type=File,
> >(Type is a returned column when using cfdirectory) and not the Type=Dir.
> >And I've got it doing basically what I want, which is excluding the Dir
> >Types, with some cfifs, but I'd rather leave them out of the over all
> >picture.  Any assistance would be greatly appreciated...
>
>
>Mmm, I don't think there is a way to do it directly with the cfdirectory
>tag.  If you are runing CF5, you can just do a query of the query that
>cfdirectory returns to get all the type='file' or type='dir' records.  If
>you are not yet on CF5 you could build another query manually (using
>combinations of queryNew(), queryAddRow(), querySetCell()) from the query
>that cfdirectory returns, opnly inserting those rows you want (i.e where
>type eq "file").
>
>
>
>
>James Sleeman
>Innovative Media Ltd
>Phone: (03) 377 6262
>http://www.websolutions.co.nz/
>
>CAUTION: The information contained in this email message is confidential
>and may be legally privileged. If the reader of this message is not the
>intended recipient you are notified that any use, dissemination,
>distribution or reproduction of this message is prohibited. If you have
>received this message in error please notify the sender immediately and
>destroy the original message and any attachments.
>
>Views expressed in this communication may not be those of Innovative Media
>Ltd.
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to