|
|
how to display time of file in seconds
$ ls -al
-rw-r--r-- 1 Jogn dba 19 Jul 19 15:04 test1
how to display time that file is last modified in seconds,not only
hour:minute?
Thanks in advance
|
|
0
|
|
|
|
Reply
|
newbie
|
7/19/2006 7:09:26 AM |
|
Hi!
I don't know any command to do that.
Here's a little python prog if you can need that:
#!/usr/bin/env python
import posix
import time
import sys
lastModifyTime=posix.stat( sys.argv[1] ).st_mtime
actTime=time.time()
print "Last Modify was %d seconds ago\n" % ( actTime - lastModifyTime )
Instead of using st_mtime you can also use st_ctime, depending on what changes you
like to track. Have a look to the stat(2) man page for an explanation of the fields.
HTH Ewald
newbie wrote:
> $ ls -al
> -rw-r--r-- 1 Jogn dba 19 Jul 19 15:04 test1
>
> how to display time that file is last modified in seconds,not only
> hour:minute?
>
> Thanks in advance
>
>
|
|
0
|
|
|
|
Reply
|
Ewald
|
7/19/2006 7:43:15 AM
|
|
newbie wrote:
> $ ls -al
> -rw-r--r-- 1 Jogn dba 19 Jul 19 15:04 test1
>
> how to display time that file is last modified in seconds,not only
> hour:minute?
man ls |grep second
|
|
0
|
|
|
|
Reply
|
ISO
|
7/19/2006 8:03:37 AM
|
|
Thommy M. Malmstr�m wrote:
> newbie wrote:
>
>>$ ls -al
>>-rw-r--r-- 1 Jogn dba 19 Jul 19 15:04 test1
>>
>>how to display time that file is last modified in seconds,not only
>>hour:minute?
>
> man ls |grep second
Only on Sol.10 i believe - at least i couldn't find a
reference to the '-e' flag on Sol.8. For systems before
Sol.10 use either what Ewald Ertl mentioned in his post,
or use the 'stat' command on the file.
Regards,
Frank
|
|
0
|
|
|
|
Reply
|
Frank
|
7/19/2006 9:26:17 AM
|
|
Frank Fegert <fra.nospam.nk@gmx.de> wrote:
>> man ls |grep second
> Only on Sol.10 i believe - at least i couldn't find a
> reference to the '-e' flag on Sol.8. For systems before
> Sol.10 use either what Ewald Ertl mentioned in his post,
> or use the 'stat' command on the file.
I don't know of any 'stat' command on Solaris, and I wouldn't expect
python on a pre-10 machine either.
You could use perl if it's on the machine.
# perl -le 'print scalar localtime ((stat "/lib")[9])'
Mon Dec 5 14:49:33 2005
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
|
|
0
|
|
|
|
Reply
|
Darren
|
7/19/2006 5:48:50 PM
|
|
Thanks all.
Darren Dunham's method would be more feasible for newbie.
"Darren Dunham" <ddunham@redwood.taos.com> wrote in message
news:6guvg.51713$VE1.50232@newssvr14.news.prodigy.com...
> Frank Fegert <fra.nospam.nk@gmx.de> wrote:
>>> man ls |grep second
>
>> Only on Sol.10 i believe - at least i couldn't find a
>> reference to the '-e' flag on Sol.8. For systems before
>> Sol.10 use either what Ewald Ertl mentioned in his post,
>> or use the 'stat' command on the file.
>
> I don't know of any 'stat' command on Solaris, and I wouldn't expect
> python on a pre-10 machine either.
>
> You could use perl if it's on the machine.
>
> # perl -le 'print scalar localtime ((stat "/lib")[9])'
> Mon Dec 5 14:49:33 2005
>
> --
> Darren Dunham ddunham@taos.com
> Senior Technical Consultant TAOS http://www.taos.com/
> Got some Dr Pepper? San Francisco, CA bay area
> < This line left intentionally blank to confuse you. >
|
|
0
|
|
|
|
Reply
|
newbie
|
7/20/2006 12:55:13 AM
|
|
|
5 Replies
1486 Views
(page loaded in 0.072 seconds)
Similiar Articles: how to display time of file in seconds - comp.unix.solaris ...Hi! I don't know any command to do that. Here's a little python prog if you can need that: #!/usr/bin/env python import posix import time import sys lastModifyTime ... Convert UTC seconds to actual time. - comp.lang.chow to display time of file in seconds - comp.unix.solaris ... Convert UTC seconds to actual time. - comp.lang.c Converting milliseconds to Days, Hours, Minutes, Seconds ... How to know and change the current display settings in Solaris ...Hi All, I wish to know the comman to know the current display setting of a solaris ... 2 Replies 222 Views (0.071 seconds) Tweet screen randomly goes blank for 1-2 seconds - comp.sys.ibm.pc ...how to display time of file in seconds - comp.unix.solaris ... Thinkpad R50 Display and boot problem - comp.sys.laptops.thinkpad ... screen randomly goes blank for 1-2 ... How to check if a PDF is valid? - comp.text.pdfHowever, from time to time there are fonts ... When opening the PDFs produced in this second way in Acrobat Reader 6.0 and Acrobat 7.0 I am getting the "Rebuild - This file ... How to Hide console window(During execution of batch file) - comp ...I am running a batch file abc.bat through my java class ... it starts the Console window which i don't want to show. ... 1 Replies 772 Views (0.045 seconds) Tweet Display real "isakmp key" on PIX 6.3 - comp.dcom.sys.cisco ...... config to a tftp server (wri net) and the display the > file ... 3 Replies 181 Views (0.097 seconds) Tweet ... Re: how to display real time video in matlab GUI On Apr 28 ... chmod and file timestamp - comp.unix.solaris... modified), and atime (time since the file was last accessed). By default, ls show the time ... comp.unix.programmer Anyway to grab a file's timestamp (date, time, seconds ... How to identify a process which exhibits a transient burst of ...... digital audio over a LAN in real time to ... The client also can display the fullness of ... should be able to run top with 1 second update interval and log the output to a file. Could anyone show me a program to count the running time of ...... transfered to it from the first program,and then print the second >> program's running time ... GUI - comp.soft-sys.matlab use input from GUI to run another .m file, show ... Display time including seconds in MS DOS - SQL*XL: Oracle to Excel ...Display time including seconds in MS DOS I wanted to test a network connection by copying some large files. It would be handy to make a batch file that displays the ... how to display time of file in seconds - comp.unix.solaris ...Hi! I don't know any command to do that. Here's a little python prog if you can need that: #!/usr/bin/env python import posix import time import sys lastModifyTime ... 7/20/2012 9:45:40 PM
|
|
|
|
|
|
|
|
|