1.

How To Remove An Empty Directory?

Answer»

If you have an empty existing directory and you want to remove it, you can use the rmdir(). Here is a PHP script example on how to use rmdir():
<?php
if (file_exists("/temp/download")) {
rmdir("/temp/download");
PRINT("Directory removed.\n");
} else {
print("Directory does not EXIST.\n");
}
?>
This script will print:
Directory removed.
If you run this script again, it will print:
Directory does not exist.

If you have an empty existing directory and you want to remove it, you can use the rmdir(). Here is a PHP script example on how to use rmdir():
<?php
if (file_exists("/temp/download")) {
rmdir("/temp/download");
print("Directory removed.\n");
} else {
print("Directory does not exist.\n");
}
?>
This script will print:
Directory removed.
If you run this script again, it will print:
Directory does not exist.



Discussion

No Comment Found