Use <cfdirectory> which returns a query set, then look at
queryname.recordcount, which returns the number of entries in the
directory, including subdirectories.  To count just the files, you'd loop
over the query and check the column named "type" as in:

<cfdirectory action="list" directory="c:\windows" name="dir">
<cfset filecount = 0>
<cfloop query="dir">
  <cfif dir.type = "file">
    <cfset filecount = filecount + 1>
  </cfif>
</cfloop>
<cfoutput>Number of files: #filecount#</cfoutput>


Jim


-----Original Message-----
From: Gregory Weiss <[EMAIL PROTECTED]>
To: '[EMAIL PROTECTED]' <[EMAIL PROTECTED]>
Date: Monday, April 24, 2000 1:55 PM
Subject: Obtain # of Files in a DIRECTORY


>This message is in MIME format. Since your mail reader does not
understand
>this format, some or all of this message may not be legible.
>
>------_=_NextPart_001_01BFAE13.01D459EE
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>I need to get a count of the number of files in a particluar =
>directory.=A0 I
>know that CFFILE allows you to do several FILE operations, but how =
>would you
>actually get a count of the number of files that exist in a particular
>directory.
>=A0
>Thanks in advance for your help.
>=A0
>Gregory L. Weiss
>Web Development Project Leader
>Trapezoid, Inc.
>4107 Laguna Street
>Coral Gables, Florida 33146
>(305) 442-8060 x230
> <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to