Number of files in a directory

2004-03-02 Thread Richard Crawford
If I'm right, then this code snippet..
=
cfdirectory directory=#pDir1# action="" name=daList sort=name 
filter=les*
cfset p = #daList.RecordCount#
=

would return to p the number of files in the directory pDir1 where the 
filenames start with the characters les.

Obviously, though, I'm not right, because p never gets a value other than 0.

What am I doing wrong?

-- 
Richard S. Crawford
Programmer III,
UC Davis Extension Distance Learning Group (http://unexdlc.ucdavis.edu)
(916)327-7793 / [EMAIL PROTECTED]
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Number of files in a directory

2004-03-02 Thread Ben Doom
This is off the top of my head, so I could be wrong, but I believe that 
filter only filters by extension.

Assuming this is true, you could either filter the list in CF or use a 
DOS command like dir /b les*.*  les_list.txt, use cffile to read it 
in, and then treat it like a linefeed-delimited list.

--Ben Doom

Richard Crawford wrote:

 If I'm right, then this code snippet..
 =
 cfdirectory directory=#pDir1# action="" name=daList sort=name
 filter=les*
 cfset p = #daList.RecordCount#
 =
 
 would return to p the number of files in the directory pDir1 where the
 filenames start with the characters les.
 
 Obviously, though, I'm not right, because p never gets a value other than 0.
 
 What am I doing wrong?
 
 -- 
 Richard S. Crawford
 Programmer III,
 UC Davis Extension Distance Learning Group (http://unexdlc.ucdavis.edu)
 (916)327-7793 / [EMAIL PROTECTED]

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Number of files in a directory

2004-03-02 Thread Lofback, Chris
In CF5, The FILTER parameter is for a wildcard file extension, like *.cfm, and only a single extension can be used.I don't think this has changed in CFMX.

Chris

-Original Message-
From: Richard Crawford [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 3:50 PM
To: CF-Talk
Subject: Number of files in a directory

If I'm right, then this code snippet..
=
cfdirectory directory=#pDir1# action="" name=daList sort=name 
filter=les*
cfset p = #daList.RecordCount#
=

would return to p the number of files in the directory pDir1 where the 
filenames start with the characters les.

Obviously, though, I'm not right, because p never gets a value other than 0.

What am I doing wrong?

-- 
Richard S. Crawford
Programmer III,
UC Davis Extension Distance Learning Group (http://unexdlc.ucdavis.edu)
(916)327-7793 / [EMAIL PROTECTED]
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Number of files in a directory

2004-03-02 Thread Nando
Richard,

I do this kind of stuff with a Q of Q, and it works well. cfdirectory returns a query.
Maybe try that.

Something like:

cfdirectory directory=#pDir1# action="" name=daList
cfquery name=daSortedList dbtype=query
SELECT *
FROM daList
WHERE Type = 'File'
AND Name Like 'les%'
/cfquery
cfset p = #daSortedList.RecordCount#

check my syntax tho' ...

nando
-Original Message-
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 10:02 PM
To: CF-Talk
Subject: Re: Number of files in a directory

This is off the top of my head, so I could be wrong, but I believe that
filter only filters by extension.

Assuming this is true, you could either filter the list in CF or use a
DOS command like dir /b les*.*  les_list.txt, use cffile to read it
in, and then treat it like a linefeed-delimited list.

--Ben Doom

Richard Crawford wrote:

 If I'm right, then this code snippet..
 =
 cfdirectory directory=#pDir1# action="" name=daList sort=name
 filter=les*
 cfset p = #daList.RecordCount#
 =

 would return to p the number of files in the directory pDir1 where the
 filenames start with the characters les.

 Obviously, though, I'm not right, because p never gets a value other than 0.

 What am I doing wrong?

 --
 Richard S. Crawford
 Programmer III,
 UC Davis Extension Distance Learning Group (http://unexdlc.ucdavis.edu)
 (916)327-7793 / [EMAIL PROTECTED]

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Number of files in a directory

2004-03-02 Thread Ben Doom
Okay, yeah.That's way smarter than my suggestions.:-)

--Ben Doom

Nando wrote:

 Richard,
 
 I do this kind of stuff with a Q of Q, and it works well. cfdirectory 
 returns a query.
 Maybe try that.
 
 Something like:
 
 cfdirectory directory=#pDir1# action="" name=daList
 cfquery name=daSortedList dbtype=query
 SELECT *
 FROM daList
 WHERE Type = 'File'
 AND Name Like 'les%'
 /cfquery
 cfset p = #daSortedList.RecordCount#
 
 check my syntax tho' ...
 
 nando
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Number of files in a directory - RESOLVED

2004-03-02 Thread Richard Crawford
Ben Doom wrote:

 Okay, yeah.That's way smarter than my suggestions.:-)
 
 --Ben Doom
 
 Nando wrote:
 
 
Richard,

I do this kind of stuff with a Q of Q, and it works well. cfdirectory 
returns a query.
Maybe try that.

Something like:

cfdirectory directory=#pDir1# action="" name=daList
cfquery name=daSortedList dbtype=query
SELECT *
FROM daList
WHERE Type = 'File'
AND Name Like 'les%'
/cfquery
cfset p = #daSortedList.RecordCount#

check my syntax tho' ...

Thanks to all who responded.Nando, your solution looks most like what 
we wound up doing.Heh.

Actually, the problem I was experiencing was due to another issue 
entirely.I'll post about that in a moment.

-- 
Richard S. Crawford
Programmer III,
UC Davis Extension Distance Learning Group (http://unexdlc.ucdavis.edu)
(916)327-7793 / [EMAIL PROTECTED]
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]