更新文件的更改日期

更新文件的更改日期

我已设法更新文件的访问和修改时间:

Access: 2003-06-03 14:45:00.000000000 +0300
Modify: 2003-06-03 14:45:00.000000000 +0300
Change: 2015-07-20 08:03:15.301534192 +0300

我如何才能对更改时间执行相同操作?仅使用触摸即可将所有时间戳更新为当前时间,但我如何才能将所有时间戳更新为自定义时间?

答案1

man touch

-d, --date=STRING
      parse STRING and use it instead of current time
-t STAMP
      use [[CC]YY]MMDDhhmm[.ss] instead of current time
DATE STRING
   The  --date=STRING  is  a mostly free format human readable date string
   such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29  16:21:42"  or
   even  "next  Thursday".   A  date  string  may contain items indicating
   calendar date, time of day, time zone,  day  of  week,  relative  time,
   relative date, and numbers.  An empty string indicates the beginning of
   the day.  The date  string  format  is  more  complex  than  is  easily
   documented here but is fully described in the info documentation.

随意选择。

相关内容