touch (target)
Update the access and modification times of each file to the current time (POSIX, toybox)
Syntax:
touch [-achm] [-d date] [-t time] [-r file] file...
Runs on:
QNX OS
Options:
- -a
- Change access time.
- -c
- Don't create file.
- -d date
- Set time to the specified date, where date is in the format:
YYYY-MM-DDThh:mm:SS[.frac][TZ]
The characters in date represent the following:
- YYYY
- The year.
- MM
- The month of the year (01-12).
- DD
- The day of the month (01-31).
- T
- The time designator.
- hh
- The hour of the day (00-23).
- mm
- The minute of the hour (00-59).
- SS
- The second of the minute (00-59).
- [.frac]
- An optional value. Represents a fractional number.
The environment variable TZ is an optional variable whose value can affect the resulting time (see below). If the resulting time precedes 0 hours, 0 minutes, 0 seconds, January 1, 1970 Coordinated Universal Time (i.e., the Epoch), touch exits immediately with an error status.
- -h
- Change symlink.
- -m
- Change modification time.
- -r file
- Set time same as the specified reference file.
- -t time
- Set time to the specified time, where time is in the format:
[[CC]YY]MMDDhhmm[.ss][frac]
The two-digit pairs in time represent the following:
- CC
- The first two digits of the year (i.e., the century).
- YY
- The second two digits of the year.
- MM
- The month of the year (01-12).
- DD
- The day of the month (01-31).
- hh
- The hour of the day (00-23).
- mm
- The minute of the hour (00-59).
- ss
- The second of the minute (00-59).
- [frac]
- An optional value. Represents a fractional number.
Both CC and YY are optional. If you specify neither of these, the current year is assumed. If you specify YY, but you don't specify CC, CC is derived as follows:
If YY is: CC becomes: 69-99 19 00-68 20 The environment variable TZ is an optional variable whose value can affect the resulting time (see below). If the resulting time precedes 0 hours, 0 minutes, 0 seconds, January 1, 1970 Coordinated Universal Time (i.e. the Epoch), touch exits immediately with an error status.
- file
- The pathname of the file whose times are to be modified.
Description:
This utility is provided as part of the toybox package. For information on how to enable it, see toybox.
Environment variables:
- TZ
- Specifies the local time for the specified time zone.
Contributing author:
Rob Landley and the toybox project (see https://landley.net/toybox/).