-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakes_cardamon.py
41 lines (30 loc) · 936 Bytes
/
makes_cardamon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# import os
# rootDir = "."
# fileSet = set()
# mega_dict = {}
# for dir_, _, files in os.walk(rootDir):
# for fileName in files:
# relDir = os.path.relpath(dir_, rootDir)
# relFile = os.path.join(relDir, fileName)
# if not relFile.startswith('.'):
# fileSet.add(relFile)
# print(sorted(fileSet))
import json
import os
rootDir = "."
fileSet = set()
for dir_, _, files in os.walk(rootDir):
for fileName in files:
relDir = os.path.relpath(dir_, rootDir)
relFile = os.path.join(relDir, fileName)
if not relFile.startswith('.'):
if not (relFile.endswith('.blkx') or relFile.endswith('.md')):
continue
fileSet.add(relFile)
cardamon_dict = {
'images': list(sorted(fileSet))
}
print(cardamon_dict)
m = json.dumps(cardamon_dict, sort_keys=True, indent=2)
with open('cardamon.json', 'w') as dfile:
dfile.writelines(m)