Apache Ant Tasks - Chmod


Description

Chmod task works on Unix and works similar to chmod command. It changes the permissions of a file or all files inside specified directories.

Properties

Sr.No Attributes & Description
1

File

The file or single directory of which the permissions must be changed. (Mandatory)

2

Dir

The directory which holds the files whose permissions must be changed. (Mandatory)

3

Perm

The new permissions. (Mandatory)

4

Includes

comma- or space-separated list of patterns of files that must be included. (Optional)

5

Excludes

comma- or space-separated list of patterns of files that must be excluded. (Optional)

6

Defaultexcludes

indicates whether default excludes should be used or not (yes|no). (Optional). Default is yes.

7

Parallel

process all specified files using a single chmod command. (Optional). Default is true.

8

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. (Optional). Default is file.

9

Maxparallel

Limit the amount of parallelism by passing at most this many sourcefiles at once. Set it to negative integer for unlimited. (Optional). Default is infinite.

10

Verbose

Whether to print a summary after execution or not. (Optional). Default is false.

11

OS

list of Operating Systems on which the command may be executed. (Optional)

12

Osfamily

OS family as used. (Optional).Default is Unix.

Example

Usage

Create build.xml with the following content −

<?xml version="1.0"?>
<project name="TutorialPoint" default="info">
   <target name="info">
      <chmod file="start.sh" perm="ugo+rx"/>
   </target>
</project>

Above script makes start.sh as readable and executable on a Unix machine.

Advertisements