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

Last reviewed: June 27, 1995
Article ID: Q95373
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.