function for building output directories and zipping directories