ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: Ant 1.7: unzip with overwrite set to 'false' is overwriting files
Date Wed, 08 Jul 2009 18:42:35 GMT
On Wed, Jul 8, 2009 at 2:22 PM, rdblaha1<> wrote:
> Thank you David for pointing out the OLDER vs. NEWER timestamp.  The
> timestamp of the existing files is always OLDER in my testing.

Would using the <touch> task help? Before unzipping, you can "touch"
all the properties files that you don't want to overwrite, giving them
a newer timestamp than the files inside the zipfile.

Of course, you'll destroy the previous dates, but it will help prevent

The other possibility is to test for the config properties files, and
if they don't exist, unzip normally. If they do exist, use the exclude
pattern. Here's a very rough and untested way of doing it:

The unzip task now simply tests to see whether or not you have
properties files. If you do, you do the unzip.selected and skip
unpacking the properties files. If you don't, you use the "unzip.all"
task and skip over the properties files.

Of course, this assumes that you either have all the properties files
or none of them:

<target name="unzip"
    <fileset id="config.files" dir="${TMP_DIR}/config">
          <include name="*.properties"/>

    <condition property="">
        <resourcecount refid="config.files" when="greater" count="0"/>

    <antcall target=unzip.all/>
    <antcall target="unzip.selected"/>

<target name="unzip.all"


<target name="unzip.selected">


Try the <touch> task first and see if that  will fix your issue.

> My problem isn't solved with the patternset as I previously thought.  If my
> config properties files don't exist in the dest directory in the first place
> I DO want them there.  The patternset will always exclude them whether they
> exist or not.   I need someway to just simply NOT overwrite them if they
> exist OLDER or NEWER timestamp.  In that case what would you suggest?
> Thanks again David,
> Rick Blaha
> David Weintraub wrote:
>> Quick question: What is the timestamp on these files?
>> If you set the overwrite parameter to false, it may be overwriting
>> files that have an OLDER timestamp than the file that's replacing it.
>> The description of this parameter is:
>>     Overwrite files, even if they are newer than the corresponding entries
>>     in the archive (true or false, default is true).
> --
> View this message in context:
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

David Weintraub

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

View raw message