2024-06-23 02:06:55 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
def rewrite_file(filepath):
|
|
|
|
with open(filepath, 'r') as f:
|
2024-06-23 03:02:26 +00:00
|
|
|
base = filepath[:-4]
|
|
|
|
newfilepath = base + ".md"
|
|
|
|
with open(newfilepath, 'w') as w:
|
|
|
|
for i, line in enumerate(f):
|
|
|
|
if ( (i == 0 and line == "Content-Type: text/x-zim-wiki\n")
|
|
|
|
or (i == 1 and line == "Wiki-Format: zim 0.26\n")
|
|
|
|
or (i == 2 and line == "Creation-Date: Not found\n")
|
|
|
|
or (i == 3 and line == "Modification-Date: Not found\n")
|
|
|
|
or (i == 4 and line == "\n")
|
|
|
|
):
|
|
|
|
continue
|
2024-06-23 02:06:55 +00:00
|
|
|
|
2024-06-23 03:02:26 +00:00
|
|
|
w.write(line)
|
2024-06-23 02:06:55 +00:00
|
|
|
|
2024-06-23 03:02:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
# for filepath in os.listdir():
|
|
|
|
# if file.endswith(".txt"):
|
|
|
|
# rewrite_file(filepath)
|