* Refactored directory cleanup function to remove contents instead of recreating directory.
* Fixed regression by ensuring directory cleanup creates directory if it does not exist.
* Modified errors in directory cleanup function to provide more information.
* Resolved use of deprecated package in directory cleanup function.
* Reformatted directory cleanup function.