title: Combine every number of files in a folder into one file
body: <p>I have a large number of files in one folder (about 2 million files), I would like to combine every 50 files into one. the code below combines all into one. I can't come about a way to combine every 50 files into one and also ensure that any number over the multiplication of 50 is also combined into one file. For example, if the number of files is 2,000,034 then I end up with many files of 50 combined files and one file that has the last 34 files. </p>
  
  <pre><code>from glob import iglob
  import shutil
  import os
  
  PATH = r'C:\Test'
  
  destination = open('allcontents.sh', 'wb')
  for file in iglob(os.path.join(PATH, '*.sh')):
      shutil.copyfileobj(open(file, 'rb'), destination)
  destination.close()
  </code></pre>