Reputation: 277
Or any other suggestions, I just want to check whether a file was renamed at a given time.
Upvotes: 2
Views: 2319
Reputation: 331
When you rename a file, out of its MAC times only the C (change) time changes:
[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: -
Upvotes: 2
Reputation: 3264
After you mv
the file to its new name, touch
the file. This will change the time stamp. As an example, I created 3 files a
, b
, and c
(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
Clearly a
was mv
'd to aa
with the original time stamp, then touch
'd to get the new time stamp.
Upvotes: 1