Reduced code duplication, and fix for logging the partially duplicated folders