note 64428 added to function.scandir
| From: | deanariel at gmail dot com | Date: | Fri, 14 Apr 2006 06:28:35 +0000 |
| Subject: | note 64428 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108033@lists.php.net to get a copy of this message | ||
recursive function to scan dirs and subdirs, it is very useful....
<?php
function rscandir($path)
{
if(!is_dir($path))
die("<b><i>{$path}</i> is not a directory.</b>");
$files = scandir($path);
foreach($files as $item)
{
if(!is_dir($path."/".$item))
{
echo "{$item}<br />"\n;
// What you want to do with your files
}
else
{
echo "<b>Scanning dir {$pth}."/".{$item}</b><br />\n";
// Calls for himself to access the subdir
rscandir($path."/".$item);
}
}
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 80.230.201.238
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- http://master.php.net/note/edit/64428
Del: integrated -- http://master.php.net/note/delete/64428/integrated
Del: useless -- http://master.php.net/note/delete/64428/useless
Del: bad code -- http://master.php.net/note/delete/64428/bad+code
Del: spam -- http://master.php.net/note/delete/64428/spam
Del: non-english -- http://master.php.net/note/delete/64428/non-english
Del: in docs -- http://master.php.net/note/delete/64428/in+docs
Del: other reasons-- http://master.php.net/note/delete/64428
Reject -- http://master.php.net/note/reject/64428
Search -- http://master.php.net/manage/user-notes.php