Tempfile

Description

This task sets a property to the name of a temporary file. Unlike the Java1.2 method to create a temporary file, this task does work with Java1.1. It does not actually create the temporary file, but it does guarantee that the file did not exist when the task was executed.

Parameters

Attribute Description Required
destdir The directory the temporary file should be located in. If not set, the current directory is used. No
prefix A prefix for the temporary file name. No
property The name of the property to set with the value of the temporary file name. Yes
suffix A suffix for the temporary file name. No

Examples

  <tempfile property="temp.file"/>
will set temp.file to the name of a new temporary file.
  <tempfile property="temp.file" suffix=".xml"/>
will set temp.file to the name of a new temporary file with a suffix of .xml.
  <tempfile property="temp.file" destdir="build"/>
will set temp.file to the name of a new temporary file located in the build sub-directory.

Copyright © 2002 Apache Software Foundation. All rights Reserved.