Touch files modified in the future using Ant

This little Ant script sets the last-modified date to the current date for all files in the given directory that have a future last-modified date.

Usage

ant -f /path/to/touch-future.xml -Ddir=<desired directory>

Files

touch-future.xml

<?xml version="1.0"?>
<!-- Created on 14.12.2004 17:30:00 by jawe -->
<project name="touch-future" default="touch">
  <description>Touch files modified in the future.</description>
 
  <target name="touch" description="Touch files modified in the future" if="dir">
  <tstamp>
   <format property="now" pattern="MM/dd/yyyy HH:mm a"/>
  </tstamp>
  <touch>
   <fileset dir="${dir}">
   <date datetime="${now}" when="after"/>
   <type type="file"/>
   </fileset>
  </touch>
  </target>
 
</project>