Sid has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to get the date a document was created using Perl? The document 'could' reside on a mapped or unc drive. Thanks, S

Replies are listed 'Best First'.
Re: Windows document create date
by Joost (Canon) on Mar 23, 2005 at 17:38 UTC
Re: Windows document create date
by manav (Scribe) on Mar 23, 2005 at 17:49 UTC
    It is also available in the list returned by
    stat($filename)
    (as the [10] element)....
    Manav

    20050324 Edit by ysth: code tags around brackets

Re: Windows document create date
by tcf03 (Deacon) on Mar 23, 2005 at 18:08 UTC
    This should work and give you human time - Its untested, but Ive used similar code in the past. I have tested it on a w2k box and it does indeed work.
    my $file="MY FILE"; my $create_seconds = ( stat($file) )[10]; $create_seconds = $create_seconds - 86400; my $creation = ( ! defined ($create_seconds) ) ? "null" :POSIX::strftime( "%B %d", $modtime_seconds, 0, 0, 0, 0, 0, 0, 0, 0 + ); print "File: $file Created: $creation\n";
    UPDATE
    dont forget to use:
    use POSIX qw(strftime);
    before using the above code.