Implement clean-dir workaround

This weird ordering ensures that directories marked Clean do not clean up
files 'required' by them even though this is backwards logic. The 'makedirs' handles
the need to have the directory created beforehand.