<touch>

Touches a file or set of files -- corresponds to the Unix touch command.

If the file specified does not exist, the task will create it.

Parameters

Attribute Type Description Required
datetime datetime
Specifies the new modification time of the file in the format MM/DD/YYYY HH:MM:SS.
False
file file
The file to touch.
False
millis long
Specifies the new modification time of the file(s) in milliseconds since midnight Jan 1 1970.
False
failonerror bool
Determines if task failure stops the build, or is just reported. The default is true.
False
if bool
If true then the task will be executed; otherwise, skipped. The default is true.
False
unless bool
Opposite of NAnt.Core.Task.IfDefined. If false then the task will be executed; otherwise, skipped. The default is false.
False
verbose bool
Determines whether the task should report detailed build log messages. The default is false.
False

Nested elements

<fileset>

Used to select files that should be touched.

</fileset>

Examples

Touch the Main.cs file. The current time is used.

<touch file="Main.cs" />

Touch all executable files in the project base directory and its subdirectories.

    <touch>
    <fileset>
        <include name="**/*.exe" />
        <include name="**/*.dll" />
    </fileset>
</touch>

Requirements

Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Tasks