touchchange file modification date |
Command |
touch
[-acm]
[-f agefile]
[-r agefile]
[[-t] time]
file ...
touch
[-acm]
time
file ...
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.
-asets only the access time.
-cdoes not create any files that do not already exist. Normally,
touch creates such files.
-msets only the modification time.
-a or -m,
touch behaves as though you specified both.
To tell touch to use a time other than the current, use
one of the following options:
-f agefileis an obsolete version of the POSIX-compliant -r
option.
-r agefilesets the access and modification times (as indicated by the other options) to those kept for agefile.
-t timespecifies a particular time using this format:
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.[[[[cc]yy]MM]dd]hhmm[.ss]
-t, but the format is:
MMddhhmmyy[yy]
sets the modification time oftouch newfile
newfile to the present.
sets the modification time oftouch -t 8001031305 oldfile
oldfile to 13:05 on January 3, 1980.
sets the modification time oftouch -r oldfile newfile
newfile to that of
oldfile.
TZcontains the time zone that touch is to use when
interpreting times.
0Successful completion.
1Failure due to any of the following:
2Failure that resulted in a usage message, including:
-t, -f, or
-r is allowed-r was missing the agefile-t was missing its argumentindicates 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.
You specified -f or -r, but did
not give a file name after it.
Your system only recognizes dates back to the given year.
touch does not accept dates before that time.
-r(-f) or
-t flag allowedSelf-explanatory.