I wonder, what's the easiest way to delete a directory with all its files in it?
I'm using rmdir(PATH . '/' . $value);
to delete a folder, however, if there are files inside of it, I simply can't delete it.
I wonder, what's the easiest way to delete a directory with all its files in it?
I'm using rmdir(PATH . '/' . $value);
to delete a folder, however, if there are files inside of it, I simply can't delete it.
Litle bit modify of alcuadrado's code -
glob
don't see files with name from points like.htaccess
so I use scandir and script deletes itself - check__FILE__
.For windows:
Here is a simple solution
This is a shorter Version works great to me
Like Playnox's solution, but with the elegant built-in DirectoryIterator: