您的位置:首页 > 运维架构 > Linux

Linux 下修改文件创建时间

2013-02-27 11:21 267 查看
在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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: