note 81158 added to function.scandir
| From: | SlowWalkere at gmail dot com | Date: | Sat, 16 Feb 2008 00:22:58 +0000 |
| Subject: | note 81158 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136190@lists.php.net to get a copy of this message | ||
Just noticed a minor difference between scandir and readdir.
When opening a directory and using readdir(), each file appears to be accessed in the process. This
resets the "Last Accessed" time that you would get with fileatime().
With scandir(), the list is created and none of the files are accessed. Therefore the access times
remain unchanged.
I encountered this while writing a script to scan a directory and delete any file that hadn't
been accessed in x time. Kind of defeated the purpose when the directory listing accessed every
file...
----
Server IP: 64.71.164.2
Probable Submitter: 67.85.183.129
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- https://master.php.net/note/edit/81158
Del: integrated -- https://master.php.net/note/delete/81158/integrated
Del: useless -- https://master.php.net/note/delete/81158/useless
Del: bad code -- https://master.php.net/note/delete/81158/bad+code
Del: spam -- https://master.php.net/note/delete/81158/spam
Del: non-english -- https://master.php.net/note/delete/81158/non-english
Del: in docs -- https://master.php.net/note/delete/81158/in+docs
Del: other reasons-- https://master.php.net/note/delete/81158
Reject -- https://master.php.net/note/reject/81158
Search -- https://master.php.net/manage/user-notes.php