Apache Ant Tasks 简明教程

Apache Ant Tasks - Chmod

Description

Chmod 任务在 Unix 中运行,并且工作方式与 chmod 命令相似。它会更改文件或指定目录中所有文件的权限。

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

Example

Usage

使用以下内容创建 build.xml −

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>

上面的脚本使 start.sh 在 Unix 机器上可读且可执行。

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