Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created May 26, 2013 02:35
Show Gist options
  • Save stevehenderson/5651508 to your computer and use it in GitHub Desktop.
Save stevehenderson/5651508 to your computer and use it in GitHub Desktop.
python program to open all files in a directory and concatenate their contents into a single output file
from glob import iglob
import shutil
import os
import fileinput
PATH = '*.csv'
with open("all_da.txt", 'w') as fout:
for filename in iglob(PATH):
for line in fileinput.input(filename):
fout.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment