Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for existing files
Message
De
26/04/2000 23:58:36
 
 
À
26/04/2000 18:20:40
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00363833
Message ID:
00363988
Vues:
55
>I could have sworn FILE() always worked O.K. but when I have a path set, FILE() finds a file in the path even when I specified a different one. For instance:
>
>Where clients.dbf exists in c:\\data, default is c:\ and the data directory is in the path:
>
>file('c:\clients.dbf') gives .T. (c:\clients.dbf does not exist)
>file('d:\clients.dbf') gives .T. (d:\clients.dbf does not exist)
>file('c:\chr\clients.dbf') gives .F. (which is right - the chr subdirectory exists)
>file('c:\zzz\clients.dbf') gives .F. (which is right - the zzz subdirectory does not exist)
>file('clients.dbf') gives .T. (although the data subdirectory is in the path but is not the current directory)
>
>Is this normal?
>

FILE() searches the VFP PATH. THe folowing is cut from the on-line help:
FILE( ) Function
Example See Also

Returns true (.T.) if the specified file is found on disk.

Syntax

FILE(cFileName)

Returns

Logical

Arguments

cFileName

Specifies the name of the file to locate. cFileName must include the file's extension. Visual FoxPro looks in the default directory for the file. If the file cannot be found in the default directory, Visual FoxPro searches along the Visual FoxPro path which is established with SET PATH.

You can include a path with the file name to search for a file in a directory or on a drive other than the current directory or drive.

Remarks

Use FILE( ) to find a file on disk. FILE( ) returns true (.T.) if the file can be found; otherwise FILE( ) returns false (.F.).

ADIR() does not do this if an expliucit path is named. Neither does the WSH's Scripting.FileSystemObject

>This behaviour extends to the USE command I.E. USE c:\clients.dbf opens the clients.dbf in the DATA subdirectory
>
>Any comments would be appreciated. In 10 year of xbase, I have never learned this???
>
>TIA
>Charles Richard
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform