NAnt SDK Documentation - v0.92

AttribTask Class

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

For a list of all members of this type, see AttribTask Members.

System.Object
   NAnt.Core.Element
      NAnt.Core.Task
         NAnt.Core.Tasks.AttribTask

[Visual Basic]
<TaskName(Name:="attrib")>
Public Class AttribTask
    Inherits Task
[C#]
[TaskName(Name="attrib")]
public class AttribTask : Task

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

AttribTask 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.

Example

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

Namespace: NAnt.Core.Tasks

Assembly: NAnt.Core (in NAnt.Core.dll)

See Also

AttribTask Members | NAnt.Core.Tasks Namespace