Article ID: 104685 - View products that this article applies to.
This article was previously published under Q104685
This article has been archived. It is offered "as is" and will no longer be updated.
This article shows by example how to use the Dir[$]() function in conjunction with the GetAttr() function to retrieve read-only, hidden, or system files.
The Dir[$] functions take a filespec and an attrmask as optional arguments.
If the attrmask argument specifies the volume label, the Dir[$] functions ignores all other attributes. If the attrmask argument is ATTR_HIDDEN, ATTR_SYSTEM, or ATTR_DIRECTORY, the functions also return the files that do not have any special attributes.
If the filespec argument is used, the functions return files that do not have any hidden, system, or directory attributes and meet the filespec requirements.
To retrieve only read-only, hidden, or system files, use the Dir[$]() functions in conjunction with the GetAttr() function. The following shows by example how to retrieve only hidden files (files that have the HIDDEN or ATTR_HIDDEN+ATTR_ARCHIVE attributes) by using the Dir() function in conjunction with the GetAttr() function.