문제

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
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top