Ant User Manual

## Attrib

Since Ant 1.6.

### Description

Changes the attributes of a file or all files inside specified directories. Right now it has effect only under Windows. Each of the 4 possible permissions has its own attribute, matching the arguments for the attrib command.

FileSets, DirSets or FileLists can be specified using nested `<fileset>`, `<dirset>` and `<filelist>` elements.

Starting with Ant 1.7, this task supports arbitrary Resource Collections as nested elements.

By default this task will use a single invocation of the underlying attrib command. If you are working on a large number of files this may result in a command line that is too long for your operating system. If you encounter such problems, you should set the maxparallel attribute of this task to a non-zero value. The number to use highly depends on the length of your file names (the depth of your directory tree), so you'll have to experiment a little.

### Parameters

Attribute | Description | Required
file | the file or directory of which the permissions must be changed. | Yes or nested `<fileset/list>` elements.
readonly | the readonly permission. | at least one of the four.
archive | the archive permission.
system | the system permission.
hidden | the hidden permission.
type | One of file, dir or both. If set to file, only the permissions of plain files are going to be changed. If set to dir, only the directories are considered. Note: The type attribute does not apply to nested dirsets - dirsets always implicitly assume type to be dir. | No, default is file
verbose | Whether to print a summary after execution or not. Defaults to `false`. | No
parallel | process all specified files using a single `chmod` command. Defaults to true. | No
maxparallel | Limit the amount of parallelism by passing at most this many sourcefiles at once. Set it to <= 0 for unlimited. Defaults to unlimited. Since Ant 1.6. | No

### Examples

>     <attrib file="${dist}/run.bat" readonly="true" hidden="true"/>

makes the "run.bat" file read-only and hidden.

>     <attrib readonly="false">
>       <fileset dir="${meta.inf}" includes="**/*.xml"/>
>     <attrib>

makes all ".xml" files below `${meta.inf}` readable.

>     <attrib readonly="true" archive="true">
>       <fileset dir="shared/sources1">
>         <exclude name="**/trial/**"/>
>       </fileset>
>       <fileset refid="other.shared.sources"/>
>     </attrib>

makes all files below `shared/sources1` (except those below any directory named trial) read-only and archived. In addition all files belonging to a FileSet with `id` `other.shared.sources` get the same attributes.