Chmod

Description

Changes the permissions of a file or all files inside specified directories. Right now it has effect only under Unix. The permissions are also UNIX style, like the argument for the chmod command.

See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task holds an implicit FileSet and supports all of FileSet's attributes and nested elements directly. More FileSets can be specified using nested <fileset> elements.

Parameters

Attribute Description Required
file the file or single directory of which the permissions must be changed. exactly one of the two or nested <fileset> elements.
dir the directory which holds the files whose permissions must be changed.
perm the new permissions. Yes
includes comma- or space-separated list of patterns of files that must be included. No
excludes comma- or space-separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. No
defaultexcludes indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. No
parallel process all specified files using a single chmod command. Defaults to true. No
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. No, default is file

Examples

<chmod file="${dist}/start.sh" perm="ugo+rx"/>

makes the "start.sh" file readable and executable for anyone on a UNIX system.


    <chmod dir="${dist}/bin" perm="ugo+rx" includes="**/*.sh"/>

makes all ".sh" files below ${dist}/bin readable and executable for anyone on a UNIX system.


<chmod perm="g+w">

  <fileset dir="shared/sources1">

    <exclude name="**/trial/**"/>

  </fileset>

  <fileset refid="other.shared.sources"/>

</chmod>

makes all files below shared/sources1 (except those below any directory named trial) writable for members of the same group on a UNIX system. In addition all files belonging to a FileSet with id other.shared.sources get the same permissions.


Copyright © 2000-2002 Apache Software Foundation. All rights Reserved.