I am working on a PHP function that will recursively remove all sub-folders that contain no files starting from a given absolute path.
Here is the code developed so
You can execute a unix command to remove empty directories.
exec("find $starting_from_path -type d -empty -exec rmdir {} \; 2>/dev/null");