Posted by Christoph Burschka on 03/26/07 18:11
Bill wrote:
> Is there a PHP function that will remove a directory that is not empty?
> I am looking for a solution that is easier than writing a recursive
> routine to delete the files in the directory tree one-by-one. Thanks
>
Can PHP run system() commands on your web server? If so, system("rm -rf ...");
(or Windows equivalent) will be the simplest.
Just make sure you do really good tests on the path used as a parameter, because
there's nothing that ruins your day like a PHP script with a vulnerability that
lets it delete your entire site.
--
cb
Navigation:
[Reply to this message]
|