Delete All Files


/ Published in: PHP
Save to your folder(s)

This isn't my code, but just thought I would share, since it took me so long to find. This is a function to delete a folder, all sub-folders, and files in one clean move.

Just tell it what directory you want deleted, in relation to the page that this function is executed. Then set $empty = true if you want the folder just emptied, but not deleted. If you set $empty = false, or just simply leave it out, the given directory will be deleted, as well.

URL: http://php.net/manual/en/function.rmdir.php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.