Created
March 28, 2023 01:04
-
-
Save dentropy/98e8d63c252ab8f2d93f40184e50e356 to your computer and use it in GitHub Desktop.
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
prepend_string = '''--- | |
share: true | |
--- | |
''' | |
import os | |
from glob import glob | |
files = glob("./files/**", recursive=True) | |
from pprint import pprint | |
for file_name in files: | |
if "md" in file_name and os.path.isfile(file_name): | |
file_contents = open(file_name, 'r').read() | |
new_file_contents = (prepend_string + file_contents) | |
new_file = open(file_name, 'w') | |
new_file.write(new_file_contents) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment