PRB: FoxPro FILE() Function Returns Wrong Results on Network

ID: Q95373

The information in this article applies to:

SYMPTOMS

When you use the FILE() function to test for the existence of a network directory, a logical true (.T.) is always returned regardless of the actual existence of the directory.

RESOLUTION

To work around this problem, use the ADIR() function. For example:

   IF ADIR(test,'Z:\mydir\*','D') <> 0
     WAIT WIND "Z:\mydir exists"
   ENDIF

This example assumes that the array "test" has not yet been defined. If the ADIR() function returns a number greater than zero, then the directory exists.

MORE INFORMATION

Using the FILE() function in this way has been found to be unreliable on network drives.

The syntax of the command is:

   ?FILE('Z:\mydir\nul')

Additional reference words: FoxDos FoxWin 2.00 null 2.50 2.50a KBCategory: kbprg kbprb KBSubcategory: FxnetworkGeneral

Last Reviewed: June 27, 1995