process.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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