How could I delete all subdirectories within a specified directory?
The directory is c:/files/
and I want to delete all subdirectories within their (example):
c:/files/something/something/something/
c:/files/another-something/
So in the end c:/files/ just remains (is empty and has no subdirectories).
rmdir() only removes the last directory in the given path…so I’m guessing i’d have to loop? :/
All help appreciated.
(PS: the subdirectories don’t contain any files)
Taken from the PHP manual entry for rmdir:
This solves the problem using recursion.