This will delete a directory and its' contents.
Set DIRECTORY_SEPARATOR to whatever fits the target OS.
function deltree($path) {
if (is_dir($path)) {
$entries = scandir($path);
foreach ($entries as $entry) {
if ($entry != '.' && $entry != '..') {
deltree($path.DIRECTORY_SEPARATOR.$entry);
}
}
rmdir($path);
} else {
unlink($path);
}
}
----
Server IP: 208.69.120.35
Probable Submitter: 87.70.70.12
----
Manual Page -- http:
//www.php.net/manual/en/function.rmdir.php
Edit -- https://master
.php.net/note/edit/78368
Del: integrated -- h
ttps://master.php.net/note/delete/78368/integrated
Del: useless -- http
s://master.php.net/note/delete/78368/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78368/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78368/spam
Del: non-english --
https://master.php.net/note/delete/78368/non-english
Del: in docs -- http
s://master.php.net/note/delete/78368/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78368
Reject -- https://mast
er.php.net/note/reject/78368
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|