note 119209 added to function.dir
| From: | synnus at gmail dot com | Date: | Tue, 19 Apr 2016 13:52:56 +0000 |
| Subject: | note 119209 added to function.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205280@lists.php.net to get a copy of this message | ||
<?php
// best small recurcive dir()
// $entry[0]!='.' <=== specifically to protect FTP files with a dot '.' as
first carractère
// return :
// download\file\text\test.txt;
// download\video\anime\test.mp4;
// download\video\film\test2.mkv;
echo rdir('download'); // start dir in \\download
function rdir($path='',$k='') {
$d = dir($path);
while (false !== ($entry = $d->read())) {
if($entry[0]!='.') {
if(is_dir($path . '\\' . $entry)) {
$k = rdir($k,$path . '\\' . $entry);
}
else {
$k .= $path . '\\' . $entry . "; \n" ;
}
}
}
$d->close();
return $k;
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 77.144.221.77
----
Manual Page -- http://php.net/manual/en/function.dir.php
Edit -- https://master.php.net/note/edit/119209
Del: integrated -- https://master.php.net/note/delete/119209/integrated
Del: useless -- https://master.php.net/note/delete/119209/useless
Del: bad code -- https://master.php.net/note/delete/119209/bad+code
Del: spam -- https://master.php.net/note/delete/119209/spam
Del: non-english -- https://master.php.net/note/delete/119209/non-english
Del: in docs -- https://master.php.net/note/delete/119209/in+docs
Del: other reasons-- https://master.php.net/note/delete/119209
Reject -- https://master.php.net/note/reject/119209
Search -- https://master.php.net/manage/user-notes.php