import os
from shutil import copyfile
folder_src = "/Users/heather/workspace/blog-jekyll/_posts"
folder_dst = "/Users/heather/workspace/zuhern.github.io/content/blog"
new_filename = "index.md"
onlyfiles = [f for f in os.listdir(folder_src) if os.path.isfile(os.path.join(folder_src, f))]
for i in range(0, len(onlyfiles)) :
filename = onlyfiles[i]
new_foldername = filename.replace('.md', '')
new_foldername = new_foldername[0:10] + "-" + new_foldername[10:]
print(new_foldername)
new_path = folder_dst + "/" + new_foldername
if not os.path.exists(new_path):
os.makedirs(new_path)
src_file = folder_src + "/" + filename
dst_file = new_path + "/" + new_filename
copyfile(src_file, dst_file)
대충 만들었음..
이전에 jekyll에서 쓴 post data 와 gatsby post data 구조가 다르면 손수 고쳐줘야 한다.
예를 들면
jekyll | gatsby | |
---|---|---|
서브 제목 | subTitle | description |
날짜 | 폴더명 앞부분 | 파일내 ‘date’ |