ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: CopyTask: attribute to overwrite readonly files
Date Fri, 23 Jul 2010 12:50:38 GMT
On Thu, Jul 22, 2010 at 2:13 PM, Vimil Saju <> wrote:
> Hi,
> I was looking if the copy task had the ability to overwrite read-only files. The manual
> that if the 'force' attribute is set to true then read-only files will be overwritten,
but it also
> says this attribute is available only on ant version 1.8.2. I don't see that version
of ant
> for download on the site.


It looks like you may have to get the latest source code and build it
yourself, or try the Hudson builds that occur on every source update.

It took me a little while to locate them: Ant's Hudson project is at If you drill down
into the build and then the build artifacts, you can find the
binaries. I found one here:

If that doesn't work, you may have to checkout the source from the
Apache Ant's source repository and try building it yourself. The
source repository is at:

The thing you may want to ask yourself is why are you trying to copy
over read-only files. In development situations, this is usually a
warning that you're trying to do something you shouldn't be doing. For
example, you have a revision control system where you have to mark
files you want to modify for checking out. (Clearcase where you have
to do a "cleartool co" or Perforce where you have to "p4 edit" files).
In this case, you're trying to overwrite files that you really don't
want to change.

If you really do need to overwrite read-only files, and you can't get
Ant 1.8.2 to work, you can always use Ant's "exec" command to call the
operating system's command to remove the read-only attribute. In
Unix/Linux, it is "chmod -R +w". In Windows, it is "attrib -r".

You can verify the OS via the "exec" command with the "exec" task's
"osfamily" parameter. It can be "unix", "windows" and "mac" (See for more
information about the possible values.).

David Weintraub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message