Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Year of Unix file

RE: Year of Unix file

From: Deshpande, Kirti <kirti.deshpande_at_verizon.com>
Date: Mon, 30 Jul 2001 05:21:25 -0700
Message-ID: <F001.00358BFB.20010730052032@fatcity.com>

Well,
Of Course... :)

> -----Original Message-----
> From: yong huang [SMTP:yong321_at_yahoo.com]
> Sent: Sunday, July 29, 2001 3:46 PM
> To: Multiple recipients of list ORACLE-L
> Subject: RE: Year of Unix file
>
> How about using stat(2)?
>
> $ ls -l proc.txt
> -rw-rw-r-- 1 oracle dba 3414 Jul 1 00:10 proc.txt
> $ perl -e '$a=(stat "proc.txt")[9]; print int $a/31536000+1970,"\n"'
> 2001
>
> There's a better way to convert seconds since epoch to year but for now I
> just
> divide it by number of seconds in a year and add 1970 to it.
>
> The above perl one-liner is just a convenient way to call stat(2).
>
> Yong Huang
> yong321_at_yahoo.com
>
> you wrote:
>
> But the year replaces the time in the 8th field only when the last
> modification time for the file is more than 6 month (even if it is in the
> current year :)
>
> For example, take a look at line 1,2 (less than 6 month old as of today) &
> 3,4,5 (over 6 months old as of today)..
>
> -rw-rw-r-- 1 oracle dba 2880 Feb 5 08:05 junk.lst
> -rwxrwx--- 1 oracle dba 410 Jan 30 11:08 show_all.ksh
> -rwx------ 1 oracle dba 77 Jan 25 2001 t1
> -rw-rw-r-- 1 oracle dba 3971 Jan 10 2001 my.lst
> -rw-rw-r-- 1 oracle dba 720 Jan 7 2001 bdf.out
>
>
> HTH...
>
> Regards,
>
> - Kirti Deshpande
> Verizon Information Services
> http://www.superpages.com
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: yong huang
> INET: yong321_at_yahoo.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Deshpande, Kirti
  INET: kirti.deshpande_at_verizon.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jul 30 2001 - 07:21:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US