note 64428 deleted from function.scandir by mazzanet

From: Date: Fri, 14 Apr 2006 09:06:50 +0000
Subject: note 64428 deleted from function.scandir by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108042@lists.php.net to get a copy of this message
Note Submitter: deanariel at gmail dot com Reason: useless ---- 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); } } } ?>

« previous php.notes (#108042) next »