Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File list
Message
De
03/12/2004 09:24:41
 
 
À
03/12/2004 02:53:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00966615
Message ID:
00966674
Vues:
6
>How to get the list of file in a directory?
>
>TIA.

If you want to get a list of files matching a certain filespec like *.txt for tyhe user to select a particular file you can use getfile("txt") function.

GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
[, nButtonType] [, cTitleBarCaption])

Getfile presents a list that contains all files matching cFileExtensions. It returns the filename with fullpath and returns an empty string when the user cancels without selecting a file.

If you are looking for a specific file and only want to present the user with a list to choose from if the file cannot be found use locfile()

LOCFILE(cFileName [, cFileExtensions] [, cFileNameCaption])

Locfile() looks for the file specified by cFileName and if found, it returns the name of the file with full path, if the file is not found it presents an open file dialog containing the files matching the specified cFileExtensions. One problem is that if the user cancels without selecting a file, it generates an error "file not found" that must be handled. This error may be handled in a try catch structure or ON ERROR function.

Or if you just want a list of files matching your criteria, use adir() to populate the an array and manipulate that array in any way required.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform