faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 12 people (17%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

How can I check remote file dates, to later use to print how old a file is?

Feb 24th, 2008 19:43
dman, Calin Uioreanu, joachim molund, http://www.ttnr.org


To get the times of local files you can use:
http://uk.php.net/manual/en/function.filemtime.php
http://uk.php.net/manual/en/function.filectime.php
http://uk.php.net/manual/en/function.fileatime.php
Beware that the call is cached per one request! If you modify for 
example the time&date of a file and then re-check the time use the 
clearstatcache function
To modify these times use:
http://uk.php.net/manual/en/function.touch.php
Now this is for local accessible files. For remote files, the option 
you have is to mount the remote partition using NTFS or to parse a ftp 
ls -l command result.
Calin Uioreanu
php9 Weblog
http://www.php9.com