import os, shutil base = '.' if os.path.exists('output/recommendation.md') else '..' src = os.path.join(base, 'output') dst = os.path.join(src, 'original_submission') os.makedirs(dst, exist_ok=True) for f in ('recommendation.md', 'comparison.csv', 'check.py'): t = os.path.join(dst, f) if os.path.exists(t): print('already preserved, not overwritten:', f) continue shutil.copyfile(os.path.join(src, f), t) print('copied', f, os.path.getsize(t), 'bytes') print(sorted(os.listdir(dst))) print(open(os.path.join(dst, 'recommendation.md')).read()[:160])