Operating System - HP-UX
1833873 Members
1604 Online
110063 Solutions
New Discussion

modified time of regular files.

 
Tony Escujuri_1
Advisor

modified time of regular files.

does the touch command modify files at second intervals. How is one to determine the actual modified time of a file if one has a group of files which are create at the same minute.

Any assistance would be great.

Regards,
Tony
I don't know very much!
5 REPLIES 5
H.Merijn Brand (procura
Honored Contributor

Re: modified time of regular files.

# perl -e 'print localtime((stat)[9]) for @ARGV' file file ...
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: modified time of regular files.

Yes, seconds

# perl -le 'print"".localtime((stat)[9])for@ARGV' file file ...

the "". is to force localtime to scalar, I could also do

scalar localtime

but golf is such a nice game :)

PC03:/tmp 507 $ perl -le 'print"".localtime((stat)[9])for@ARGV' *.*
Thu Oct 24 07:31:15 2002
Thu Oct 24 07:30:58 2002
Thu Oct 24 07:30:32 2002
Wed Apr 17 10:33:15 2002
Wed Apr 17 13:02:40 2002
Fri Dec 7 18:40:06 2001
Sun Dec 16 10:41:09 2001
Sun Dec 16 12:36:57 2001
Sat Dec 29 20:36:13 2001
Wed Dec 26 19:49:59 2001
Wed Apr 3 09:52:53 2002
Wed Apr 3 10:07:44 2002
Wed Oct 16 09:39:19 2002
Thu Feb 15 21:06:05 2001
Sun Jun 23 20:30:00 2002
Sat Mar 4 20:43:45 2000
Mon Dec 31 16:01:16 2001
Sun Jan 6 14:55:38 2002
Thu Sep 5 11:15:54 2002
Fri Oct 4 07:49:14 2002
Sat Mar 23 10:01:40 2002
PC03:/tmp 508 $
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: modified time of regular files.

And /with/ filenames:

PC03:/tmp 510 $ perl -le 'print localtime((stat)[9])." ",$_ for@ARGV' *.*
Thu Oct 24 07:31:15 2002 20021023-005-i32-1.exe
Thu Oct 24 07:30:58 2002 20021023-005-i32-2.zip
Thu Oct 24 07:30:32 2002 20021023-005-i32-3.zip
Wed Apr 17 10:33:15 2002 Diac-uni-LC.png
Wed Apr 17 13:02:40 2002 Diac-uni-XT.png
Fri Dec 7 18:40:06 2001 Route7.cdr
Sun Dec 16 10:41:09 2001 b1213.pl
Sun Dec 16 12:36:57 2001 b1213.sh
Sat Dec 29 20:36:13 2001 cmnt.txt
Wed Dec 26 19:49:59 2001 mdog.txt
Wed Apr 3 09:52:53 2002 mktest.log
Wed Apr 3 10:07:44 2002 mktest.out
Wed Oct 16 09:39:19 2002 no-t5.diff
Thu Feb 15 21:06:05 2001 pct.pl
Sun Jun 23 20:30:00 2002 setup.log
Sat Mar 4 20:43:45 2000 test.pl
Mon Dec 31 16:01:16 2001 top2000_word.doc
Sun Jan 6 14:55:38 2002 vakantie.txt
Thu Sep 5 11:15:54 2002 w3m-0.1.10-tb2.tbz
Fri Oct 4 07:49:14 2002 xx.dta
Sat Mar 23 10:01:40 2002 xx.txt
PC03:/tmp 511 $
Enjoy, Have FUN! H.Merijn
James R. Ferguson
Acclaimed Contributor

Re: modified time of regular files.

Hi Tony:

You can 'stat()' the file with a C program (attached), or you can download a "super ls" program from the HP porting center:

http://hpux.cs.utah.edu/hppd/hpux/Shells/sls-1.0/

Regards!

...JRF...
john korterman
Honored Contributor

Re: modified time of regular files.

Hi Tony,
I have seen one of the Pharaos (cannot remember which one, perhaps mr. P. Wallek) suggest this command sequence:
# echo | cpio -o 2>/dev/null | cpio -ivt 2>/dev/null

which produces something like this for the /etc/passwd on my system:
100444 root 2422 Okt 17 15:06:20 2002 /etc/passwd

regards,
John K.

it would be nice if you always got a second chance