Chown

Since Ant 1.6.

Description

Changes the owner of a file or all files inside specified directories. Right now it has effect only under Unix. The owner atribute is equivalent to the coresponding argument for the chown 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 owner must be changed. Yes or nested <fileset/list> elements.
owner the new owner. Yes
parallel process all specified files using a single chown command. Defaults to true. No
type One of file, dir or both. If set to file, only the owner 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
maxparallel Limit the amount of parallelism by passing at most this many sourcefiles at once. Set it to <= 0 for unlimited. Defaults to unlimited. No
verbose Whether to print a summary after execution or not. Defaults to false. No

Examples

<chown file="${dist}/start.sh" owner="coderjoe"/>

makes the "start.sh" file belong to coderjoe on a UNIX system.

    <chown owner="coderjoe">
      <fileset dir="${dist}/bin" includes="**/*.sh"/>
    </chown>

makes all ".sh" files below ${dist}/bin belong to coderjoe on a UNIX system.

<chown owner="coderjoe">
  <fileset dir="shared/sources1">
    <exclude name="**/trial/**"/>
  </fileset>
  <fileset refid="other.shared.sources"/>
</chown>

makes all files below shared/sources1 (except those below any directory named trial) belong to coderjoe on a UNIX system. In addition all files belonging to a FileSet with id other.shared.sources get the same owner.

<chown owner="webadmin" type="file">
  <fileset dir="/web">
    <include name="**/*.cgi"/>
    <include name="**/*.old"/>
  </fileset>
  <dirset dir="/web">
    <include name="**/private_*"/>
  </dirset>
</chmod>

makes cgi scripts, files with a .old extension or directories begining with private_ belong to the user named webadmin. A directory ending in .old or a file begining with private_ would remain unaffected.


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