#!/usr/bin/env python3
import os
import csv

files = []
for r, d, f in os.walk("artikel"):
    for file in f:
        if '.txt' in file:
            files.append(os.path.join(r, file))

of = open("articles.csv", "w")
o = csv.writer(of)
for f in files:
    with open(f) as file:
      print(f)
      data = file.read()
      o.writerow([f, data.replace("\n", " ")])

of.close()
