p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_howto thread: help/syntax guidance using attributes/methods of FSO

Message #1 by "Jeff Gaudet" <gaudet54@h...> on Wed, 7 Feb 2001 02:15:58 -0000
well, supposing that your relative path is correct, use the FileExists method of the

(you probably want to rename your variables, hard to read and understand at a

dim objfile


If getfile2.FileExists(getfile1) then
  'the file exists, now check it's size
  set objfile = getfile2.getfile(getfile1)
  if objfile.size > 0 then
      'the file is larger than 0MB
    'put your loop here to wait for the file to finish
    'unfortunately, i've never done a "timed" loop, but i guess,
    'you could try this - all though it will bring down the server's resources
       set objfile = nothing
       set objfile = getfile2.getfile(getfile1)
       if objfile.size > 0 then
           exit do
       end if
    loop until 1=2
    'the file doesn't exist
end if

the FSO stuff should work just fine, but i'd try to find a better way to "wait" for
the file to be created.

just some thoughts,


--- Jeff Gaudet <gaudet54@h...> wrote:
> My dillemma is that I am using the FileSystemObject to access files on our
> NT server. My code to get the file I want to open is this:
> getfile1 = "..\..\..\..\..\..\nfl\internet\" & random1 & ".132" 
> Set getfile2 = Server.CreateObject("Scripting.FileSystemObject") 
> getfile3 = Server.MapPath(getfile1) 
> Set InStream = getfile2.OpenTextFile(getfile3, 1, False, False)
> I then read the file line by line... 
> The issue at hand is that I need to set this block of code up so that I
> first check to see if it exists, and secondly if it does exist, make sure
> that it is not 0 MB. In this case my ASP page may try and access the file
> before another application is finished creating it - hence the 0 MB rule.
> I need a way of looping to see if the file exists and is not 0 mb. Can
> someone help me with the code/syntax please?????? Please

John Pirkey 

  Return to Index