Properly handle creation of output folders.