0

My batch program had been working without any problems for a decade. I replaced a NFS(Network File System) with new one. After that, it has become to fail once or twice per month. (The program is working three times per day)

The following is an excerpt that causes the above problem. FolderExists() occasionally doesn't return true though a folder path really exists.

Function foo(path)
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")

    If objFileSystem.FolderExists(path) Then
        ' do something
    End If

Could anyone give me any advice?

Here is the OS information.

Windows Server 2003
Service Pack2
Sankame
  • 113
  • 9

1 Answers1

0

It may be that, for some reason, the drive is not currently ready for access. You can do a check for this, using the FSO, by getting a Drive object from the GetDrive method and checking the IsReady property. More info: http://msdn.microsoft.com/en-us/library/x681abd9(v=vs.84).aspx

crackalak
  • 563
  • 3
  • 7
  • Thank you for your quick response. I'll try to log the value the function returns. – Sankame Oct 22 '13 at 01:34
  • I ran a checking program once per ten minutes. And I finally discovered that "DriveExists" returns false when "FolderExists" returns false. (At the time "GetDrive" or "IsReady" throws system error without returning true or false) So I'm planning to use "DriveExists" to check if the drive is ready or not. Thanks a lot! – Sankame Mar 03 '14 at 08:54