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.

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

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.


Copyright © 2002-2004 The Apache Software Foundation. All rights Reserved.