#!/bin/python3 # little script to go over each image in images/ and change the front matter properties. import os CONTENT_DIR = '../content/images/' images_dirs = os.listdir(CONTENT_DIR) for dir in images_dirs: try: id = int(dir) except ValueError: continue # change tags to image-tags path = CONTENT_DIR + dir + '/index.md' print(path) # index_file = open(path, 'w+') # content = index_file.read() # print(content) # content = content.replace('tags:', 'image-tags:') # print(content) break index_file.write(content) index_file.close()