ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "O'Hara, Patrick" <patrick.oh...@workscape.com>
Subject A question about delete
Date Thu, 21 Jun 2001 16:24:46 GMT
I have the following build.xml

<project name="Backup" default="zipit" basedir=".">
  <target name="init">
    <property name="source.dir" value="."/>
    <property name="target.dir" value="${source.dir}/backup"/>
    <mkdir dir="${target.dir}"/>
    <tstamp/>
    <filter token="backupdate" value="${DSTAMP}"/>
    <filter token="backuptime" value="${TSTAMP}"/>
    <property name="backup.name" value="${DSTAMP}${TSTAMP}.zip"/>
  </target>

  <target name="del-old" depends="init">
    <echo message="Deleting old backup file"/>
    <delete verbose="true">
      <fileset dir="${target.dir}" includes="*.bak"/>
    </delete>
    <!-- Moving the last zip file to a bak file -->
    <move todir="${target.dir}">
      <fileset dir="${target.dir}">
        <patternset>
          <include name="**/*.zip"/>
        </patternset>
      </fileset>
      <mapper type="regexp" from="^(.*)\.zip$$" to="\1.zip.bak"/>
    </move>
  </target>

  <target name="zipit" depends="init, del-old">
    <zip zipfile="${target.dir}/${backup.name}"
         basedir="${source.dir}"
         excludes="${target.dir}/**"
         />
    <echo message="Backup complete"/>
  </target>
</project>

The first time through there is nothing in the backup directory (it was just
created).  The del-old task deletes the directory.  I think this may be a
bug with the fileset as the directory backup does not match the includes.


Patrick O'Hara
Workscape, Inc
N17 W24222 Riverwood Pl
Waukesha, WI 53188-1162
262-408-3849
262-408-3840 Fax
patrick.ohara@workscape.com
 <<O'Hara, Patrick.vcf>> 

Mime
View raw message