Add in removal of trailing / character to fix mkpath error in recursion