java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Ant arrow How to use Attrib task
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4092
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Attrib task E-mail
User Rating: / 2
PoorBest 

Attrib

Since Ant 1.6.

Description

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.

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

By default this task will use a single invocation of the underlying 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 directory tree), so you'll have to experiment a little.

Parameters

Attribute Description Required
file the file or directory of which the permissions must be changed. Yes or nested <fileset/list> elements.
readonly the readonly permission. at least one of the four.
archive the archive permission.
system the system permission.
hidden the hidden permission.
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.
Note: The type attribute does not apply to nested dirsets - dirsets always implicitly assume type to be dir.
No, default is file
verbose Whether to print a summary after execution or not. Defaults to false. No

Examples

<attrib file="${dist}/run.bat" readonly="true" hidden="true"/>

makes the "run.bat" file read-only and hidden.

<attrib readonly="false">
  <fileset dir="${meta.inf}" includes="**/*.xml"/>
<attrib>

makes all ".xml" files below ${meta.inf} readable.

<attrib readonly="true" archive="true">

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

</attrib>

makes all files below shared/sources1 (except those below any directory named trial) read-only and archived. In addition all files belonging to a FileSet with id other.shared.sources get the same attributes.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.