Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/codes-snippets/config.php on line 6
Php Delete Folder - Php

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