# <attrib>

Changes the file attributes of a file or set of files and directories.

<attrib> task does not have the concept of turning attributes off. Instead you specify all the attributes that you want turned on and the rest are turned off by default.

Refer to the FileAttributes enumeration in the .NET SDK for more information about file attributes.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
archive | bool | Set the archive attribute. The default is false. | False
file | file | The name of the file which will have its attributes set. This is provided as an alternate to using the task's fileset. | False
hidden | bool | Set the hidden attribute. The default is false. | False
normal | bool | Set the normal file attributes. This attribute is only valid if used alone. The default is false. | False
readonly | bool | Set the read-only attribute. The default is false. | False
system | bool | Set the system attribute. The default is false. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Nested Elements:

#### <fileset>

All the matching files and directories in this fileset will have their attributes set.

#### </fileset>

### Examples

- Set the `read-only` file attribute for the specified file in the project directory.

      <attrib file="myfile.txt" readonly="true" />

- Set the `normal` file attribute for the specified file.

      <attrib file="myfile.txt" normal="true" />

- Set the `normal` file attribute for all executable files in the current project directory and sub-directories.

      <attrib normal="true">
          <fileset>
              <include name="**/*.exe" />
              <include name="bin" />
          </fileset>
      </attrib>

### Requirements

Assembly: NAnt.Core (0.90.3780.0)