Skip to content

Instantly share code, notes, and snippets.

@mentiflectax
Created March 17, 2020 15:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mentiflectax/54d3d5c7ab7826d1bf4a1f33c49bbe46 to your computer and use it in GitHub Desktop.
process.py
import os
exec(open("py/addTextFragment.py").read())
input_dir = "input"
processed_dir = "processed"
# Find all files in the input directory
files = [f for f in listdir(input_dir) if isfile(join(input_dir, f))]
files_to_process = []
for file in files:
if (file.endswith(".toml")):
files_to_process.append(file)
if (len(files_to_process) < 1):
print("No files to process")
print("Need to process " + str(len(files_to_process)) + " file(s)")
ctr = 1
for file in files_to_process:
print("Processing file " + file + " (" + str(ctr) + " of " + str(len(files_to_process)) + ")")
add_text_fragment(input_dir + "/" + file)
# move file to processed/
os.rename(input_dir + "/" + file, processed_dir + "/" + file)
ctr = ctr + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment