<?php
$folderPath = "C:/wamp";
printDir($folderPath, 0);
function printDir($rootPath, $deep)
{
echo $rootPath."<br>";
$folderArr = scandir($rootPath);
foreach ($folderArr as $path)
{
$currPath = $rootPath."/".$path;
if ($path != "." && $path != "..")
{
if (is_dir($currPath))
printDir($currPath, $deep + 1);
else
printItem($path, $deep + 1);
}
}
}
function printItem($path, $deep)
{
echo "|";
for ($i = 0; $i < $deep - 1; $i++)
{
echo " |";
}
echo "----".$path."<br>";
}
?>