Page 1 of 1
Arranging Contents of file by date added
Posted: Fri Jan 16, 2004 6:31 pm
by maboroshi
Hi I searched for this for a while on google but could not find anything
I have a script that access a directory I would like the contents of my directory to be arranged by date added descending
any help is alway's appreciated
Thank You
Posted: Fri Jan 16, 2004 7:57 pm
by dull1554
i'm pretty sure that php cant access the win32 created file info, so unless you were to name your files like blah_1_16_04.blah then you can just explode() the file name
Posted: Fri Jan 16, 2004 8:22 pm
by ilovetoast
To get file info you can use:
fileatime - for time file was last accessed, on Win32 it will return last modified time
filemtime - for time last modified
filectime - detects last time inode was changed, useless on Win32
and of course the mother of all file info commands:
stat (see
http://www.php.net/manual/en/function.stat.php)
peace
Posted: Fri Jan 16, 2004 8:23 pm
by dull1554
as i thought you cant decern the date the file was created.
Posted: Fri Jan 16, 2004 8:32 pm
by ilovetoast
Actually you could hack together a way of doing it on a Unix system.
Basically you use symlinks.
Make a symlink for each file, and never use them. Check the symlinks last modified time using lstat(). You can update and change the files all you want, without chaning the last mod (and therefore creation date) of the symlink.
Of course you'd need to filter your directory listing to get only the symlinks......