1

或任何其他建议,我只想检查文件是否在给定时间重命名。

4

2 回答 2

1

在你mv把文件改成新名字后,touch文件。这将更改时间戳。例如,我创建了 3 个文件abc(via touch a b c)

23:11:50 --> ls -l
total 0
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 a
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 b
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 c
23:11:52 --> mv a aa
23:12:18 --> ls -l
total 0
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 aa
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 b
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 c
23:12:21 --> touch aa
23:12:47 --> ls -l
total 0
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:12 aa
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 b
-rw-rw-r-- 1 kkanos kkanos 0 Oct  3 23:11 c

显然amv'd to aawith the original time stamp,然后touch'd to get the new time stamp。

于 2013-10-04T03:15:02.083 回答
0

重命名文件时,在其 MAC 时间之外,只有 C(更改)时间更改:

[luke@ll test]$ touch file_time
[luke@ll test]$ stat file_time 
  File: 'file_time'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd04h/64772d    Inode: 33845249    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    luke)   Gid: ( 1000/    luke)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2018-01-30 18:09:48.157529527 +0100
Modify: 2018-01-30 18:09:48.157529527 +0100
Change: 2018-01-30 18:09:48.157529527 +0100
 Birth: -
[luke@ll test]$ mv -iv file_time file_time2
'file_time' -> 'file_time2'
[luke@ll test]$ stat file_time2 
  File: 'file_time2'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd04h/64772d    Inode: 33845249    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    luke)   Gid: ( 1000/    luke)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2018-01-30 18:09:48.157529527 +0100
Modify: 2018-01-30 18:09:48.157529527 +0100
Change: 2018-01-30 18:09:58.033633333 +0100
 Birth: -

于 2018-01-30T17:17:34.627 回答