Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find date and time information for a folder

Status
Not open for further replies.

tswitz00

IS-IT--Management
Jan 26, 2005
67
US
How can I use perl to find the creation date of a file or folder?
 
google for perlfunc and stat

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
use File::stat;
use Time::localtime;
$date_string = ctime(stat($file)->ctime);

 
Alternatively, if you are on unix/linux
Code:
$ls_command =`ls -ld your_directory`;
($date, $time) = (split(/\s+/, $ls_command)) [5,6]
print "$date, $time";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top