Name

touch

Synopsis

Updates the timestamp of one or more files.

Attributes

datetime (all, String, N)

The new modification time for the file(s), in the format MM/DD/YYYY HH:MM AM or PM. Defaults to the current time.

file (all, File, *)

Name of a file to touch. The file is created if it does not exist. To touch directories, use nested <fileset> elements.

millis (all, long, N)

The new modification time for the file, expressed as the number of milliseconds since January 1, 1970.

The file attribute is required unless a nested <fileset> is specified.

Content

0..n nested <fileset> elements (1.4)

Specifies files and directories to touch.

Example Usage

Update the timestamp of build.xml with the current time:

<touch file="build.xml"/>

Change the timestamp of all files and directories in the build directory:

<touch datetime="06/25/1999 6:15 AM">
  <fileset dir="${builddir}"/>
</touch>

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.