Touch

Description

Changes the modification time of a file and possibly creates it at the same time. In addition to working with a single file, this Task can also work a Fileset (which also includes directories).

For JDK 1.1 only the creation of new files with a modification time of now works, all other cases will emit a warning.

Parameters

Attribute Description Required
file the name of the file unless a nested fileset element has been specified.
millis specifies the new modification time of the file in milliseconds since midnight Jan 1 1970 No
datetime specifies the new modification time of the file in the format MM/DD/YYYY HH:MM AM_or_PM. No

If both millis and datetime are omitted the current time is assumed.

Examples

  <touch file="myfile"/>

creates myfile if it doesn't exist and changes the modification time to the current time.

  <touch file="myfile" datetime="06/28/2000 2:02 pm"/>

creates myfile if it doesn't exist and changes the modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24 hour times).

  <touch datetime="09/10/1974 4:30 pm">

    <fileset dir="src_dir"/>

  </touch>

changes the modification time to Oct, 09 1974 4:30 pm of all files and directories found in src_dir.


Copyright © 2000-2001 Apache Software Foundation. All rights Reserved.