Linux 下修改文件创建时间

在linux下编译文件,源文件的时间戳很多都是错的,好吧,开始修改文件的时间戳

google了一下,发现用touch命令可行,以前一直以为touch命令就是为了创建文件的


由于很多文件的时间戳都坏掉了,和find命令组合使用

find ./ -exec touch -t 201302271109 {} \;

man touch 手册页

NAME
       touch - change file timestamps
SYNOPSIS
       touch [OPTION]... FILE...

-a     change only the access time
       -c, --no-create
              do not create any files
       -d, --date=STRING
              parse STRING and use it instead of current time
       -f     (ignored)
       -m     change only the modification time
       -r, --reference=FILE
              use this file's times instead of current time
       -t STAMP
              use [[CC]YY]MMDDhhmm[.ss] instead of current time
       --time=WORD
              change the specified time: WORD is access, atime, or use: equiv‐
              alent to -a WORD is modify or mtime: equivalent to -m
       --help display this help and exit
       --version
              output version information and exit

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 cal‐
       endar date, time of day, time zone, day of week, relative  time,  rela‐
       tive 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.



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值