Skip to content

Instantly share code, notes, and snippets.

@MrJeremyHobbs
Created June 6, 2019 21:32
Show Gist options
  • Select an option

  • Save MrJeremyHobbs/184f47b92820a1d598fff0a2ccd406a3 to your computer and use it in GitHub Desktop.

Select an option

Save MrJeremyHobbs/184f47b92820a1d598fff0a2ccd406a3 to your computer and use it in GitHub Desktop.
#!/bin/usr/python3
import glob
import shutil
# get list of all MRC files in Downloads folder
files = glob.glob("c:\\users\\jthobbs\\downloads\\*.mrc")
# generate combined MARC file
with open('c:\\users\\jthobbs\\Desktop\\KANOPY_RECORDS.mrc','wb') as wfd:
for f in files:
with open(f,'rb') as fd:
shutil.copyfileobj(fd, wfd, 1024*1024*10)
#10MB per writing chunk to avoid reading big file into memory.
# finish
print("Done.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment