Php Delete Folder - Php

How to delete a folder using php code?

Snippet Code

Rate this page :
  [ 0 votes]

Here, delete_dir($fol_path) function is used to delete folder. If deleted, an alert is displayed as "Deleted Successfully", else "Failed". Use this php code to delete folder.

<?php function delete_dir($fol_path) { if (is_dir($fol_path)) { rmdir($fol_path); return true; } else { return false; } } $path="./test"; if(delete_dir($path)) { echo "Deleted Successfully"; } else { echo "Failed.."; } ?>


Ask Questions

Ask Question