If you are using CFMX (maybe even prior versions - I am not sure, you can
use the windows file system COM object to count the files and even get the
total size etc. I am doing this on a project and it is working great.

Try the below code, modify it for your needs. And I suggest doing some
CFDUMP's of the COM object which will show you what methods are available.
CFDUMP is the shit.

Note, that in the below example I am counting the number of files in 2
folders and getting the total, you might not need to do that step.
I also use this to count mail files for IMS, and use it to count up to
200,000 files or so all the time.

<!--- start code --->

<cfset Folder2Check1 = "f:\ims\out\">
<cfset Folder2Check2= "f:\ims\out\queued">

<!--- Connect to the File System Object --->
<cflock timeout="30" throwontimeout="No" name="#CreateUUID()#"
type="EXCLUSIVE">
     <cftry>
         <cfobject type="COM" name="FSO" class="Scripting.FileSystemObject"
action="">            </cfobject>
         <cfcatch>
             <cfobject type="COM" name="FSO"
class="Scripting.FileSystemObject" action="">              </cfobject>
         </cfcatch>
     </cftry>
</cflock>

<cfscript>
objFolder      = FSO.getFolder(Folder2Check1);
objFolderSize = LSParseNumber(objFolder.size);
objtest= objFolder.files;
objfileCount1=objtest.count;

objFolder      = FSO.getFolder(Folder2Check2);
objtest= objFolder.files;
objfileCount2=objtest.count;

</cfscript>

<cfset total=objfileCount1+objfileCount2>

<cfoutput>
         Total Files Used: #LSParseNumber(DecimalFormat(total))#<BR>
     Total Space Used: #LSParseNumber(DecimalFormat(Evaluate(objFolderSize
/ 1000000)))#
</cfoutput>

<!--- end code --->

Brook Davies

At 02:26 PM 10/13/2003, you wrote:
>CF-Pros:
>
>We have several report utilities written in CF to report on our e-mail
>system, Ipswitches iMail.
>
>We've been asked to look into a utility (acquire/build) to count the
>number of messages in each folder.
>
>Questions:
>
>* What is the delimiter for messages in a folder (is it the same for all
>   mail servers, or unique to a particular mailer, again, we use
>Ipswitches's iMail, latest version)
>
>* I believe some of you are iMail users, anyone aware of utility similar
>   to what we are interested in ?
>
>Thank you.
>
>-Gerry
>
>Gerard T. Pauline
>Computer Systems, DoIT
>Pace University
>
>----------
>[
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to