title: Using Ant, can I change a property name if it already exists?
body: <p>I currently have a  batch file that will copy some test results to a directory. That directory will have a date (yyyy-mm-dd). If that date already exists, it will create a new folder with that same date, but append a run number (yyyy-mm-dd run 2, yyyy-mm-dd run 3)</p>
  
  <pre><code>@echo off
  title Copy the FF results to the results folder
  
  set "date=%date:~10,4%-%date:~4,2%-%date:~7,2%"
  set "run="
  set "browser=FF"
  set "results_paste=C:\TestProject\Results"
  
  :loop
  if "%run%"=="1" set "date=%date%_run "
  if "%run%"=="1" set "run=2"
  if EXIST "%results_paste%\%date%%run%\%browser%\" set /a run+=1&amp;goto loop
  
  REM Create HTML directory and copy results
  xcopy "%workspace%\test-output\html\*.*" "%results_paste%\%date%%run%\%browser%\"
  
  REM Create screenshot directory and copy results
  xcopy "%workspace%\test-output\XML\screenshots\*.*" "%results_paste%\%date%%run%\XML\screenshots\"
  </code></pre>
  
  <p>How would I accomplish this same functionality using ANT? Here is what I have so far. I'm not sure how to check if the date folder already exists, and if it does, to create a run 2 folder. </p>
  
  <pre><code>&lt;project default="CopyResults"&gt;
  
          &lt;property name="Run" value="" /&gt;
          &lt;tstamp&gt;
            &lt;format property="Date" pattern="yyyy-mm-dd" locale="en,US,WIN" /&gt;
          &lt;/tstamp&gt;
  
          &lt;copy todir="C:/Results/${Date}${Run}/${Project}/${Browser}"&gt;
            &lt;fileset dir="C:/Program Files (x86)/Jenkins/jobs/${PROJECT_NAME}/workspace/test-output/html/*.*"&gt;
          &lt;/copy&gt;
  
          &lt;dirname property="directoryProperty" file="C:/Program Files (x86)/Jenkins/jobs/$PROJECT_NAME/workspace/test-output/${XML}/screenshots"/&gt;
          &lt;mkdir dir="${directoryProperty}"/&gt;
  
          &lt;copy todir="C:/Results/${Date}${Run}/${Project}/${XML}/screenshots/"&gt;
            &lt;fileset dir="C:/Program Files (x86)/Jenkins/jobs/${PROJECT_NAME}/workspace/test-output/${XML}/screenshots/*.*"&gt;
          &lt;/copy&gt;
  </code></pre>