International PHP Conference Munich 2025

Voting

: one plus four?
(Example: nine)

The Note You're Voting On

avi dot megladon at gmail dot com
12 years ago
loop through folders and sub folders with option to remove specific files.

<?php
function listFolderFiles($dir,$exclude){
$ffs = scandir($dir);
echo
'<ul class="ulli">';
foreach(
$ffs as $ff){
if(
is_array($exclude) and !in_array($ff,$exclude)){
if(
$ff != '.' && $ff != '..'){
if(!
is_dir($dir.'/'.$ff)){
echo
'<li><a href="edit_page.php?path='.ltrim($dir.'/'.$ff,'./').'">'.$ff.'</a>';
} else {
echo
'<li>'.$ff;
}
if(
is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff,$exclude);
echo
'</li>';
}
}
}
echo
'</ul>';
}

listFolderFiles('.',array('index.php','edit_page.php'));
?>

<< Back to user notes page

To Top