| 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | import sys |
| 4 | import shutil |
| 5 | |
| 6 | |
| 7 | def main(): |
| 8 | if len(sys.argv) < 3: |
| 9 | print("Usage: python join_files.py <input_files>... <output_file>") |
| 10 | sys.exit(1) |
| 11 | |
| 12 | input_files = sys.argv[1:-1] |
| 13 | output_file = sys.argv[-1] |
| 14 | |
| 15 | with open(output_file, 'wb') as outfile: |
| 16 | for fname in input_files: |
| 17 | with open(fname, 'rb') as infile: |
| 18 | shutil.copyfileobj(infile, outfile) |
| 19 | |
| 20 | |
| 21 | if __name__ == "__main__": |
| 22 | main() |
| 23 |