Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check the creation time of a file

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I need to check if a file was updated in the last 2 hours (NOT DAYS).
find -atime +2 does not work for me.
Any ideas ?
 
Hi Tison,

Looks like -atime and -mtime both require decimal integers so you can't check for this with the find command.

Your way forward seems to be to write a script that does the same checking job as find but checks for hours or minutes rather than days.

What scripting languages do you have available? Perl would be the easiest I think.

Mike
michael.j.lacey@ntlworld.com
 
No unix system stores the creation time of files... you can check the access date, modification date or modification date of i-node... ONLY
 
infact -a and -mtime parameters take the integer value multiplied by 24 hours.so probably you have to write a
script for your specified purpose.
 
Elgis,

At the risk of sounding stupid here, I thought the inode date *was* the file creation date; how can it not be? My understanding was that an inode is only modified when a file is created or deleted.
Mike
michael.j.lacey@ntlworld.com
 
The i-node of a file stores the owner, group, dates, sizes, and permissions... then if you change ANY of that attributes then you will be changing that i-node!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top