• Post category:PHP

How to Delete Directory in PHP | Explained

 Delete Directory PHP

To delete directories in PHP, we need to use the rmdir() funciton. rmdir() takes a single argument, the name of the directory to be deleted. The deletion will only be successful if the directory is empty. If the directory contains files or other subdirectories the deletion cannot be performed until those files and subdirectories are also deleted.


if ( is_dir('/tmp/bin"))

In the above code, first we have condition like If the “bin” directory exists then delete otherwise not delete.

Leave a Reply