Operating System - HP-UX
1834674 Members
2209 Online
110069 Solutions
New Discussion

Date Stamp on file down to seconds?

 
SOLVED
Go to solution
Lisa  Mauer
Regular Advisor

Date Stamp on file down to seconds?

Is there anyway to see the date stamp on a file down to the seconds? Not sure why, but we have a client who wants to be able to see the file date/time down to seconds...
Thx!
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Date Stamp on file down to seconds?

Here's one method that leverages Perl's stat() and localtime() functions to do just what you want.

ftimes.pl -a myfile (for time of last access)
ftimes.pl -m myfile (for time of last modification -- default)
ftimes.pl -c myfile (for time of last change)

or
add -e to any of these and get the epoch seconds printed directly.

If it ain't broke, I can fix that.
Sundar_7
Honored Contributor

Re: Date Stamp on file down to seconds?

Lisa,

You can also use cpio.

echo "filename" | cpio -o 2>/dev/null | cpio -ivt 2>/dev/null

But guess probably going to be little slower.

- Sundar.
Learn What to do ,How to do and more importantly When to do ?
Lisa  Mauer
Regular Advisor

Re: Date Stamp on file down to seconds?

Excellent! Clay - Thank you! Exactly what I was looking for!
Lisa  Mauer
Regular Advisor

Re: Date Stamp on file down to seconds?

Thanks Sundar! That worked also :)
RAC_1
Honored Contributor

Re: Date Stamp on file down to seconds?

For Sundar,

What time is it?? access, change, modification time??
There is no substitute to HARDWORK
RAC_1
Honored Contributor

Re: Date Stamp on file down to seconds?

Got it, it is last modification time. man cpio
There is no substitute to HARDWORK