Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP get create time of directory

Tags:

php

Is there anyway to find the created time of a directory in php? I've tried filectime but that only works on files.

like image 873
sumo Avatar asked Jul 25 '11 12:07

sumo


2 Answers

In unix a folder is also a file. So it should work for that too

$folder = 'includes';

echo date ("F d Y H:i:s.", filemtime($folder));

Output is

October 06 2010 20:20:58.
like image 81
Chris Avatar answered Oct 14 '22 22:10

Chris


It should work for directories, this is what I get:

$ php -r "echo filectime(__DIR__);"
1311596297
like image 29
chelmertz Avatar answered Oct 14 '22 23:10

chelmertz