ALiAuto
ALiAuto

Reputation: 15

ant copy directory and add name to destination

I'm trying to copy directory with it's content using ant script, also I want to set current date as directory name on destination.

This is the script that I write:

<property name="current_date" value="${build.date}"/>
<copy todir="T:/Ali/backup/reports/${current_date}">
    <fileset dir="log/current" />
</copy>

After executing the ant script the directory name at the destination is ${current_date} and not actual current name.

any help!!

Upvotes: 1

Views: 34

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521053

Ant has a built-in tstamp task which can get the current date:

<tstamp>
    <format property="TODAY_US" pattern="yyyy-mmmm-dd" locale="en,US"/>
</tstamp>
<copy todir="T:/Ali/backup/reports/${TODAY_US}">
    <fileset dir="log/current" />
</copy>

Upvotes: 1

Related Questions