Hakyll Bulk rename

Posted on October 2, 2012
Tags: hacksoft

I like to cluster related post together and I do that by renaming files with their dates. To do this in bulk run the script below. It will rename all the .md files in the folder to the new date.

import os
import re
print("hello")
for filename in os.listdir("."):
    # print(filename)
    newname = re.sub("[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-","2019-04-25-" , filename)
    os.rename(filename,newname)

Drop this into some directory like posts/LinearAlgebra/rename.py
Then run with python3 rename.py