2018-12-21 11:20:43 +01:00
|
|
|
<!DOCTYPE html>
|
2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
2019-05-25 13:41:47 +02:00
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
2006-09-11 04:19:00 +00:00
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2018-12-21 11:20:43 +01:00
|
|
|
<html lang="en">
|
2002-11-07 16:26:18 +00:00
|
|
|
|
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2010-11-11 17:04:16 +00:00
|
|
|
<title>Apache Ant User Manual</title>
|
2002-11-07 16:26:18 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="attrib">Attrib</h2>
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Apache Ant 1.6</em>.</p>
|
2002-11-07 16:26:18 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Changes the attributes of a file or all files inside specified directories. Right now it has
|
|
|
|
effect only under Windows. Each of the 4 possible permissions has its own attribute, matching the
|
|
|
|
arguments for the attrib command.</p>
|
2002-11-07 16:26:18 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><a href="../Types/fileset.html">FileSet</a>s, <a href="../Types/dirset.html">DirSet</a>s
|
|
|
|
or <a href="../Types/filelist.html">FileList</a>s can be specified using
|
|
|
|
nested <code><fileset></code>, <code><dirset></code> and <code><filelist></code>
|
|
|
|
elements.</p>
|
2002-11-07 16:26:18 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><em>Since Ant 1.7</em>, this task supports
|
2018-03-05 17:35:30 +01:00
|
|
|
arbitrary <a href="../Types/resources.html#collection">resource collections</a> as nested
|
2018-02-28 07:58:59 +01:00
|
|
|
elements.</p>
|
2005-09-28 18:48:41 +00:00
|
|
|
|
2010-06-17 12:39:27 +00:00
|
|
|
<!--p>By default this task will use a single invocation of the underlying
|
2005-03-22 11:11:48 +00:00
|
|
|
attrib command. If you are working on a large number of files this
|
|
|
|
may result in a command line that is too long for your operating
|
|
|
|
system. If you encounter such problems, you should set the
|
|
|
|
maxparallel attribute of this task to a non-zero value. The number to
|
|
|
|
use highly depends on the length of your file names (the depth of your
|
2010-06-17 12:39:27 +00:00
|
|
|
directory tree), so you'll have to experiment a little.</p-->
|
2005-03-22 11:11:48 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>By default this task won't do anything unless it detects it is running on a Windows system. If
|
|
|
|
you know for sure that you have a <code>attrib</code> executable on your <code>PATH</code> that is
|
|
|
|
command line compatible with the Windows command, you can use the task's <var>os</var> attribute and
|
|
|
|
set its value to your current OS.</p>
|
2008-11-14 15:12:26 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>See the <a href="setpermissions.html">setpermissions</a> task for a platform independent
|
|
|
|
alternative.</p>
|
2016-04-17 17:30:07 +02:00
|
|
|
|
2002-11-07 16:26:18 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-11-07 16:26:18 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td>the file or directory of which the permissions must be changed.</td>
|
|
|
|
<td>Yes, or nested <code><fileset/list></code> elements</td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>readonly</td>
|
|
|
|
<td>the readonly permission.</td>
|
|
|
|
<td rowspan="4">At least one of the four</td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>archive</td>
|
|
|
|
<td class="left">the archive permission.</td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>system</td>
|
|
|
|
<td class="left">the system permission.</td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>hidden</td>
|
|
|
|
<td class="left">the hidden permission.</td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>type</td>
|
|
|
|
<td>One of <q>file</q>, <q>dir</q> or <q>both</q>. If set to <q>file</q>, only the permissions
|
|
|
|
of plain files are going to be changed. If set to <q>dir</q>, only the directories are
|
|
|
|
considered.<br/>
|
2018-01-24 21:40:28 +01:00
|
|
|
<strong>Note</strong>: The type attribute does not apply to
|
2018-02-28 07:58:59 +01:00
|
|
|
nested <code>dirset</code>s—<code>dirset</code>s always implicitly assume type to
|
|
|
|
be <q>dir</q>.</td>
|
|
|
|
<td>No; default is <q>file</q></td>
|
2002-11-07 16:26:18 +00:00
|
|
|
</tr>
|
2003-05-21 08:55:35 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>verbose</td>
|
|
|
|
<td>Whether to print a summary after execution or not.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-05-21 08:55:35 +00:00
|
|
|
</tr>
|
2010-06-17 12:39:27 +00:00
|
|
|
<!--tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>parallel</td>
|
|
|
|
<td>process all specified files using a single
|
2018-03-10 20:17:33 +01:00
|
|
|
<kbd>chmod</kbd> command.</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>true</q></td>
|
2005-11-16 19:40:28 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>maxparallel</td>
|
|
|
|
<td>Limit the amount of parallelism by passing at
|
|
|
|
most this many sourcefiles at once. Set it to negative integer for
|
|
|
|
unlimited. <em>Since Ant 1.6</em>.</td>
|
|
|
|
<td>No, defaults to unlimited</td>
|
2010-06-17 12:39:27 +00:00
|
|
|
</tr-->
|
2008-11-14 15:12:26 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>os</td>
|
|
|
|
<td>list of Operating Systems on which the command may be executed.</td>
|
|
|
|
<td>No</td>
|
2008-11-14 15:12:26 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>osfamily</td>
|
|
|
|
<td>OS family as used in the <a href="../Tasks/conditions.html#os"><os></a>
|
2008-11-14 15:12:26 +00:00
|
|
|
condition.</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>windows</q></td>
|
2008-11-14 15:12:26 +00:00
|
|
|
</tr>
|
2002-11-07 16:26:18 +00:00
|
|
|
</table>
|
2008-02-27 11:48:02 +00:00
|
|
|
|
2002-11-07 16:26:18 +00:00
|
|
|
<h3>Examples</h3>
|
2018-02-09 06:54:03 +01:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Make the <code>run.bat</code> file read-only and hidden.</p>
|
2005-03-11 09:42:56 +00:00
|
|
|
<pre><attrib file="${dist}/run.bat" readonly="true" hidden="true"/></pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Make all <samp>.xml</samp> files below <samp>${meta.inf}</samp> readable.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre><attrib readonly="false">
|
2002-11-07 16:26:18 +00:00
|
|
|
<fileset dir="${meta.inf}" includes="**/*.xml"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</attrib></pre>
|
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Make all files below <samp>shared/sources1</samp> (except those below any directory
|
|
|
|
named <samp>trial</samp>) read-only and archived. In addition all files belonging to a FileSet
|
|
|
|
with <var>id</var> <samp>other.shared.sources</samp> get the same attributes.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2002-11-07 16:26:18 +00:00
|
|
|
<attrib readonly="true" archive="true">
|
|
|
|
<fileset dir="shared/sources1">
|
|
|
|
<exclude name="**/trial/**"/>
|
|
|
|
</fileset>
|
|
|
|
<fileset refid="other.shared.sources"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</attrib></pre>
|
2018-02-09 06:54:03 +01:00
|
|
|
|
2002-11-07 16:26:18 +00:00
|
|
|
</body>
|
|
|
|
</html>
|