Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
titaniumnetwork-dev
GitHub Repository: titaniumnetwork-dev/Ludicrous
Path: blob/main/public/webretro/bundle/indexer.py
1223 views
1
import os, json
2
3
wpaths = []
4
wfiles = []
5
outfile = "indexedfiles-out.txt"
6
7
if os.path.exists(outfile):
8
os.remove(outfile)
9
10
for root, dirs, files in os.walk("."):
11
path = root[1:].split("/")
12
wpaths.append(["/".join(path[:-1]), path[-1]])
13
if root[1:]:
14
for f in files:
15
wfiles.append(root[1:] + "/" + f)
16
17
wpaths = wpaths[1:]
18
19
open(outfile, "w").write(json.dumps(wpaths)+",,,\n"+("\n".join(wfiles)))
20