Recursive delete function 

as @dom-mel mentioned in #284 this really should be in io.php