Cari di Apache Ant 
    Apache Ant Tutorial
Daftar Isi
(Sebelumnya) ChecksumChmod (Berikutnya)
Apache Ant Tasks

Chgrp

Chgrp

Since Apache Ant 1.6.

Description

Changes the group of a file or all files inside specifieddirectories. Right now it has effect only under Unix. The groupattribute is equivalent to the corresponding argument for the chgrpcommand.

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

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

By default this task will use a single invocation of the underlyingchgrp command. If you are working on a large number of files this mayresult in a command line that is too long for your operating system.If you encounter such problems, you should set the maxparallelattribute of this task to a non-zero value. The number to use highlydepends on the length of your file names (the depth of your directorytree) and your operating system, so you'll have to experiment alittle. POSIX recommends command line length limits of at least 4096characters, this may give you an approximation for the number youcould use as initial value for these experiments.

By default this task won't do anything unless it detects it is running on a Unix system. If you know for sure that you have a "chgrp" executable on your PATH that is command line compatible with the Unix command, you can use the task's os attribute and set its value to your current os.

Parameters

Attribute Description Required
file the file or directory of which the group must be changed. Yes, unless nested <fileset|filelist|dirset> elements are specified
group the new group. Yes
parallel process all specified files using a single chgrp command. Defaults to true. No
type One of file, dir or both. If set to file, only the group 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
os list of Operating Systems on which the command may be executed. No
osfamily OS family as used in the <os> condition. No - defaults to "unix"

Examples

<chgrp file="${dist}/start.sh" group="coders"/>

makes the "start.sh" file belong to the coders group on aUNIX system.

<chgrp group="coders">  <fileset dir="${dist}/bin" includes="**/*.sh"/></chgrp>

makes all ".sh" files below ${dist}/binbelong to the coders group on a UNIX system.

<chgrp group="coders">  <fileset dir="shared/sources1"> <exclude name="**/trial/**"/>  </fileset>  <fileset refid="other.shared.sources"/></chgrp>

makes all files below shared/sources1 (except thosebelow any directory named trial) belong to the coders group on a UNIX system. In addition all files belonging to a FileSetwith id other.shared.sources get the samegroup.

<chgrp group="webdev" type="file">  <fileset dir="/web"> <include name="**/*.test.jsp"/> <include name="**/*.new"/>  </fileset>  <dirset dir="/web"> <include name="**/test_*"/>  </dirset></chmod>

makes all .test.jsp, and .new files belong to group webdev. Directories beginning with test_ also will belong to webdev, but if there is a directory that ends in .new or a filethat begins with test_ it will be unaffected.

(Sebelumnya) ChecksumChmod (Berikutnya)