Thread: last modified?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    71
    Rep Power
    15
    How do I retrieve last modified attribute of some file in perl?
    And in what format will that number be?
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>How do I retrieve last modified attribute of some file in perl?

    #!/usr/local/bin/perl

    $file = "/system/path/to/file";

    print "Content-type: text/htmlnn";
    $ls= `ls -ATl $file`;
    @fields = split(/s+/, $ls);
    print "$fields[7] $fields[5] $fields[6], $fields[8]";

    >>And in what format will that number be?
    10:23:02 Jul 9, 2000 or rotate the $fields[x] to whatever format you like


    To retrieve the lat modified time of the file (i.e. hello.html) itself, simply do the following:
    #hello.html
    <html>
    <body>
    <!--#echo var="LAST_MODIFIED"-->
    </body>
    </html>

    The format is:
    Sunday, 09-Jul-2000 10:23:02 PDT
  4. #3
  5. No Profile Picture
    ledjon
    Guest
    Devshed Newbie (0 - 499 posts)
    Nice.

IMN logo majestic logo threadwatch logo seochat tools logo