Once you have taken the if out of the above inner loop, change this to

    require(consolidateShuffleFiles)