Ant provides task ‘Touch’ to create file and extensively set modification time of either newly created or any existing resources, it is even able to copy the modification time from old file to new created one, this task creates an empty file without content included, it can have any file name and suffix name as you specified.

Example to create File with Ant

<touch file="newfile.txt"/>

Creates ‘newfile.txt’ in current user work directory if it doesn’t exist, the datetime did not set so by default change the modification time of newly created file to the current time.

<touch file="newfile.txt" datetime="11/20/2012 2:00 pm"/>

Creates “newfile.txt” if it doesn’t exist and changes the modification time to 11/20/2012 2:00 pm. For the datetime, you have to follow the date format as Ant documents suggested.

<touch datetime="11/20/2012 2:00 pm">
  <fileset dir="c:\asjava"/>

Change the modification time to 11/20/2012 2:00 pm of files and directories found in c:\asjava, so it does not create any new files or folders, it just modifies the metadata of these pre-existing files, it sets modification time for the first children so doesn’t recursively set deep ones.