Tools, FAQ, Tutorials:
Removing an Empty Directory in PHP
How To Remove an Empty Directory in PHP?
✍: FYIcenter.com
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.
2016-11-24, 1247👍, 0💬
Popular Posts:
How to search for the first match of a regular expression using re.search()? The re.search() functio...
How to write a policy to set and get custom variables? Here is a policy that sets and gets custom va...
How to pull NVIDIA CUDA Docker Image with the "docker image pull nvidia/cuda" command? If you are ru...
How to extend json.JSONEncoder class? I want to encode other Python data types to JSON. If you encod...
What Is Azure API Management Service? Azure API Management as a turnkey solution for publishing APIs...