Domanda

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
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top