YAY! I just finished my directoryDelete() function, it's basic and I haven't added error checking yet, but it does the job great. I think I'll write something to chmod the files though, because permissions on my Linux testing server aren't right.
Anyways, here goes. Defec, your wisdom would be ace here.
PHP:
function directoryDelete($dir) {
$openDir = dir($dir);
while($file = $openDir->read()) {
if($file != '.' && $file != '..') {
if(is_dir($dir .'/'. $file)) {
directoryDelete($dir .'/'. $file);
} else {
@unlink($dir .'/'. $file);
}
}
}
$openDir->close();
rmdir($dir);
}
Thanks Defec, you rock. Do you reckon this is OK, or is there anything you'd change? After a bit of research I found an idea for a loop for the subdirectories, which seems to run OK for me at least. Thoughts welcome.
-Luke.