- Forums
- PHP
- How To Remove Directory Delete Directories Wiht PHP Code
This Page Contains information about How To Remove Directory Delete Directories Wiht PHP Code By wallpaperama in category PHP with 3 Replies. [1115], Last Updated: Sat May 18, 2024
wallpaperama
Mon Mar 03, 2008
3 Comments
2532 Visits
deleting or removing directories or folders with php is simple
rmdir()
Removes directory
example, lets say i want to remove or delete a directory called images, this is how i would do it with php
$mydir = '/path/directory/images/';
rmdir($mydir);
thats it
but this would be a more practical use, first i want to check if the directory even exists:
$mydir = '/path/directory/images/';
if (is_dir($mydir)) {
rmdir($mydir);
} else {
echo $mydir.' does not exists';
}
heidisoft /blog/php-recursive-directory-remov