This method returns the name of a file, directory, or folder that matches a specified pattern or file attribute.
file.Dir(pathname,[ attributes])
Constant |
Value |
Description |
fsAttrNormal | 0 | Normal |
fsAttrReadOnly | 1 | Read-only |
fsAttrHidden | 2 | Hidden |
fsAttrSystem | 4 | System file |
fsAttrVolume | 8 | Volume label. If specified, all other attributes are ignored. |
fsAttrDirectory | 16 | Directory or folder |
fsAttrArchive | 32 | Archive |
String. File name that matches pathname and attributes. Dir returns a zero-length string ("") if pathname is not found.
Dir supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files. You must specify pathname the first time you call the Dir method. In addition, if you specify file attributes you must include pathname.
The Dir method returns the first file name that matches pathname. To get any additional file names that match pathname, call Dir again with no parameters. When no more file names match, Dir returns a zero-length string (""). Once a zero-length string is returned, you must specify pathname in subsequent calls.