Dir Function

  1. Dir[(path,attributes)]

Returns the first file/directory name that matches the given path and attributes. If you want the next matched item, simply use the Dir function again without any arguments.

path is optional and is the pathway to the directory or file. If no path is found, the function returns a string of zero-length. You can also use * and ? wild cards. For example, d:\temp\*.bmp would match bitmap image files in that directory.

attributes is an optional number representing the sum of all the file or directory attributes. These attributes can be a combination of one or more of these values:

  1. 0 - Normal (Default)

    1 - Read-only

    2 - Hidden

    4 - System file

    8 - Volume label

    16 - Directory or folder

    64 - File name is an alias

So, to return a hidden system file, you would use a value of 6 (4 for the system file attribute plus 2 for the hidden attribute). Most of the time you will just use 0.

More:

Example - Dir Function