note 46638 deleted from function.opendir by sean
| From: | sean@php.net | Date: | Mon, 18 Oct 2004 23:11:13 +0000 |
| Subject: | note 46638 deleted from function.opendir by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78737@lists.php.net to get a copy of this message | ||
Note Submitter: hasibiqbal at hotmail dot com
----
You can use htmlentities for directory names which have spaces in between them.
e.g.
function:
--------------------------------
function dir_s($strDir,$strSpace='')
{
$dirhandle=opendir($strDir);
$file='';
while (FALSE !== ($file = readdir($dirhandle)))
{
echo $strSpace.$file."<br>";
if (is_dir($strDir."/".htmlentities($file)))
{
if ($file!='.' && $file!='..')
dir_s($strDir."/".htmlentities($file),
$strSpace." ");
}
}
closedir($dirhandle);
}
----------------------
usage:
----------------------
dir_s('sampledir','');
it worked fine for me,
----
Reason: bad code