Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How do I determine file creation or last-access date?

by rupesh (Hermit)
on Jul 23, 2003 at 16:01 UTC ( [id://277224]=perlquestion: print w/replies, xml ) Need Help??

rupesh has asked for the wisdom of the Perl Monks concerning the following question: (files)

Is there a way to find out when a file was created/last accessed, just like one would get to see while doing a ls-l or dir in DOS?

Originally posted as a Categorized Question.

  • Comment on How do I determine file creation or last-access date?

Replies are listed 'Best First'.
Re: File Date
by The Mad Hatter (Priest) on Jul 23, 2003 at 16:05 UTC
    See perldoc -f stat and perldoc -f -X.
Re: File Date
by draconis (Scribe) on Jul 23, 2003 at 20:34 UTC
    Perl's stat() is a great function for extracting file specific info!
Re: How do I determine file creation or last-access date?
by amitbhosale (Acolyte) on Feb 13, 2008 at 10:20 UTC

    The ctime() function provides a way of getting at the scalar sense of the original CORE::localtime() function.

    use Time::localtime; use File::stat; for ( @ARGV ) { print "\nFile: $_"; print "\n Last access time: ", ctime( stat($_)->atime ); print "\n Last modify time: ", ctime( stat($_)->mtime ); print "\n File creation time: ", ctime( stat($_)->ctime ); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://277224]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found