SYNOPSIS
touch
[
touch
[
DESCRIPTION
The touch command changes certain dates for each file argument. By default, touch sets both the date of last file modification and the date of last file access to the current time. This is useful for maintaining correct release times for software and is particularly useful in conjunction with the MKS Make software development facility.
Options
-a -
sets only the access time.
-c -
does not create any files that do not already exist. Normally, touch creates such files.
-m -
sets only the modification time.
If you do not specify
To tell touch to use a time other than the current, use one of the following options:
-f agefile-
is an obsolete version of the POSIX-compliant
-r option. -r agefile-
sets the access and modification times (as indicated by the other options) to those kept for agefile.
-t time-
specifies a particular time using this format:
[[[[cc]yy]MM]dd]hhmm[.ss]
where cc is the optional first 2 digits of the year, yy is the optional last 2 digits of the year, MM is the optional number of the month (01-12), dd is the optional day of the month, hh is the hour in 24 hour format (required), mm is the minutes (required), ss is the optional seconds.
An obsolete (but still supported) version of this command lets you omit
the
MMddhhmmyy[yy]
EXAMPLES
touch newfile
sets the modification time of newfile to the present.
touch -t 8001031305 oldfile
sets the modification time of oldfile to 13:05 on January 3, 1980.
touch -r oldfile newfile
sets the modification time of newfile to that of oldfile.
ENVIRONMENT VARIABLES
DIAGNOSTICS
Possible exit status values are:
- 0
-
Successful completion.
- 1
-
Failure due to any of the following:
- 2
-
Failure that resulted in a usage message, including:
Messages
- Age file inaccessible
-
indicates that time could not be found for the file given with the
-f or-r option either because that file does not exist or because the requesting user is not granted the appropriate permission for the file. - Missing age file argument
-
You specified
-f or-r , but did not give a file name after it. - Years earlier than year invalid
-
Your system only recognizes dates back to the given year. touch does not accept dates before that time.
- Bad date conversion
- Only one
-r (-f ) or-t flag allowed - Missing date/time argument
-
Self-explanatory.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.
NOTE
touch is provided as both an external utility and a built-in MKS KornShell utility.
On the extended FAT file system, the earliest date accepted is 1980. On the NTFS file system, the earliest date accepted is 1970.
The touch utility does not accept dates and times past 11:59.59 pm on December 31, 2099.
AVAILABILITY
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation
SEE ALSO
PTC MKS Toolkit 10.4 Documentation Build 39.