PHP delete all files and folders in directory recursively

Here is the short and the best code for removing directories and files from the current folder with the help of PHP Code. Check this function and run it. In this function we are getting the current path of a directory with this function realpath (dirname (__FILE__)) and then get all the directories and files and check if directory empty then delete if not then check is file and unlink it and this process goes recursively.

Check this code

If you really like this post. Please Comment or share for others help with social buttons. You can more read useful articles


Add a Comment

Your email address will not be published. Required fields are marked *