Mike,

Thanks for the info, I'll try it out along with the function Barney mentioned.  To answer your question though, I didn't use java because I'm not very experienced using java and there, when trying to solve a problem, it's not the first option that I turn to.

It sounds like this will solve the specific problem that I mentioned, but doesn't address the more common instance where a filter is used to pull files matching a pattern using a wildcard.  I'm sure there's some other java code to handle this as well, but wouldn't it be nice if  ColdFusion was up to handle this.  I wonder why ColdFusion doesn't garner more respect than it does in the developer community at large.

I would still like an answer to my original question as to how to bring this to macromedia's attention.

Thanks,

-Nelson

----- Original Message -----
  From: Mike Townend
  To: CF-Talk
  Sent: Tuesday, October 21, 2003 2:13 PM
  Subject: RE: cfdirectory = slow

  why not use java ?

  <CFOUTPUT>
      #CreateObject("java",
  "java.io.File").init(FileNameAndPathHere).lastModified()#
  </CFOUTPUT>

  HTH

  -----Original Message-----
  From: Nelson Winters [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 19:02
  To: CF-Talk
  Subject: Re: cfdirectory = slow

  Thanks for the suggestion.  In my case, I actually need to get the
  LastModifiedDate provided by cfdirectory.  I can work around the problem by
  calling some Delphi code a coworker created, but I'd like to see the problem
  get fixed.  This really shouldn't be a problem.  In this particular case I'm
  only retrieving 1 file, however, this issue would affect any filtered
  directory listing.

  -Nelson

  ----- Original Message -----
    From: Barney Boisvert
    To: CF-Talk
    Sent: Tuesday, October 21, 2003 1:46 PM
    Subject: RE: cfdirectory = slow

    If you are only pulling one file back, why are you using CFDIRECTORY at
  all?
    You already know the filename, so you can just use fileExists() to check
  if
    it's there, and CFFILE to read it in if you need the contents.
      -----Original Message-----
      From: Nelson Winters [mailto:[EMAIL PROTECTED]
      Sent: Tuesday, October 21, 2003 10:24 AM
      To: CF-Talk
      Subject: cfdirectory = slow

      Where do I report issues with CFMX to Macromedia?  I know I'm not the
    first
      to discover this, but cfdirectory is extremely inefficient when dealing
    with
      large directories.  I don't know if this is a problem with J2EE platform
      that CFMX runs on top of or what, but it shouldn't take several seconds
  to
      do a cfdirectory where I'm pulling only one file back, even if the
    directory
      has a 100,000+ files in it.   It seems like cfdirectory loads the entire
      directory contents into memory and then applies the filter.

      Below is some sample code if anyone wants to see what I'm talking about.

      -Nelson

      <!--- Create a bunch of files --->
      <cfset vDir = "d:\test">
      <cfset NumberOfFilesToCreate = 100000>

      <cfif NOT DirectoryExists(vDir)>
          <cfdirectory action="" directory="#vDir#">
      </cfif>

      <cfloop from="1" to="#NumberOfFilesToCreate#" index="i">
      <cffile action="" file="#vDir#\z#i#.txt" output="This is file
  number
      #i#.">
      </cfloop>

      <!--- Get File Info --->
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <body>
      <cfset start = GetTickCount()>
      <cfset tmp = Randomize(right(start, 8))>
      <cfset fileIndex = RandRange(1, 1000000)>
      <cfif FileExists("#vDir#\z#fileIndex#.txt")>
      <cfdirectory action="" directory="#vDir#" name="dirTest"
      filter="z#fileIndex#.txt" >
      <cfdump var="#dirTest#">
      <cfoutput>@#fileContents#@</cfoutput>
      <cfelse>
      <cfoutput>File not found.</cfoutput>
      </cfif>
      <hr>Processing Time: <cfoutput>#GetTickCount()-Start#</cfoutput>
      </body>
      </html>

    _____  


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

Reply via email to