note 21742 deleted from function.rmdir by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 07 Aug 2004 23:48:01 +0000 |
| Subject: | note 21742 deleted from function.rmdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74171@lists.php.net to get a copy of this message | ||
Note Submitter: jcn50@usa.net
----
PHP 4.1.2 is missing for a good delete folders function, that's why there's a lot of post
here :p...
Here's my function that removes a directory (empty OR NOT EMPTY) on any Platform (Windows or
Unix/Linux based). Enjoy!
function rmdir2($Path)
{
if (substr_count($SystemDrive,":"))
{system("rmdir/S/Q \"".$Path."\"");}
else {system("rm -r ".$Path);}
}
Remark: add "@" before the system function so you won't get any error display:
@system