Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by rupesh (Hermit)
on Jul 23, 2003 at 16:01 UTC ( #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
Node Status?
node history
Node Type: perlquestion [id://277224]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2021-04-21 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?