>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement