chunk = (total + # of chunks)/ # of chunks and remainder = total % # of chunks chunk = total / # of chunk foreach (chunk #){ if (remainder < # of chunks){ add one to ensure that all data is divided between files } }