@tnl : The script I posted last was what I thought you needed. It loops through any paths in the $dir_stack array and removes any files from them, whilst doing this it also pushs any directories found to the $dir_stack array for the next loop. Once it has gone as far as it can in the directory tree pushing directories and unlinking files found the loop ends. Then it loops backwards from the deepest sub directory back up to the parent removing the directories that are now all empty. That exact script I posted could only be cleaned up a little(maybe 2 lines less). But I tested it on around 20 directories with at least 5 sub directories in each with files all over the place and more directories in the sub directories. It deleted them all faster than windows ever could have
PHP:
$dir_stack = array('test/'); // can be 1 path or many
$i = 0;
while ($i <= count($dir_stack)-1)
// starts the loop with as many paths there are but the max on the loop increases every time a directory path is pushed to it.
{
echo $dir_stack[$i].'<br>'; // Just to check what directory is being processed.
if ($dir = opendir($dir_stack[$i]))
{
while (false !== ($file = readdir($dir))) // loop through everything in the directory
{
if ($file != "." && $file != ".." && false == is_dir($dir_stack[$i].$file)) // if its a file unlink it
{
unlink($dir_stack[$i].$file);
}
elseif ($file != "." && $file != "..") // else add it to the dir_stack to loop through next
{
array_push($dir_stack,$dir_stack[$i].$file.'/');
}
}
closedir($dir);
}
$i++;
}
$i = count($dir_stack)-1;
while ($i >= 0) // here we go backwards from the deepest directories to the top level
{
rmdir($dir_stack[$i]);
$i--;
}
even Brandon agreed this was a good idea
@ TA : I am assuming you tried to call the function that parses the index page to many times. There was a thread about this in the staff section where I had my account suspended for high resource usage. The AIP wasn't written by me, I only modded it. It works well if you call a few of the functions. I will take a look at it in a few days again to see what else can be done to reduce the resource usage. It is defiantly not the statBar that is causing it, this I know cause I codded that myself and also cause I made a page that has 101 random reasons on it ->
http://www.defectalisman.com/class/test2.php
http://www.defectalisman.com/class/test3.php
(just watch this might eat up your download bandwidth and currently it is on the staff server so it wont suspend my account no matter how much you try)
I refreshed this page like crazy whilst another member did and my account didn't get caught by the script.
@ Daniel : One thing everyone neglected to say which is the best way to describe php. php is the glue that holds the web together. It can be placed directly in html and is read as the page is parsed.
html/css would be used as a means to output/display something. xml can be used as the carrier of data or for storage of data and php is what makes it all work.