public static void deleteTree ( ContentManager contentManager , String path ) throws AccessDeniedException , StorageClientException { Content content = contentManager . get ( path ) ; if ( content != null ) { for ( String childPath : content . listChildPaths ( ) ) { deleteTree ( contentManager , childPath ) ; } } contentManager . delete ( path ) ; }
Delete an entire tree starting from the deepest part of the tree and working back up . Will stop the moment a permission denied is encountered either for read or for delete .