Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a File On a Drive
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00508805
Message ID:
00508831
Vues:
20
>Is there a way either in VFP6 or VFP7 to determine if a specified file exists on a drive and if so, in which subdirectory? FILE() won't help because it looks only along the VFP path. I am trying to determine if a specified file appears anywhere on a given drive.

Chaim,

You'll have to write a routine to recurse the drive's directory structure if the file can be anywhere on the drive. There have been several threads (and maybe a file posted) that can do this. I think Cetin Basoz posted something recently.

As for the FILE() function, it searches the VFP path if the file isn't in the current directory and no path is specified. With one exception, if the path is also passed, it just searches there. The one exception is the root of the drive. The following is an example:
* The specified file is in the current directory but not on the path
? FILE('MY_PRG.PRG') && Returns .T.
* The specified file is not in the current directory but on the path
? FILE('MY_PRG.PRG') && Returns .T.
The specified file is not in the current directory and not on the path
? FILE('MY_PRG.PRG') && Returns .F.
* The file is in the specified folder and nowhere else
? FILE('C:\MYFOLDER\MY_PRG.PRG') && Returns .T.
* The file is not in the current folder, but on the path
? FILE('C:\MY_PRG.PRG') && Returns .T.??
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform