indexer.py 402 B

12345678910111213141516171819
  1. import os, json
  2. wpaths = []
  3. wfiles = []
  4. outfile = "indexedfiles-out.txt"
  5. if os.path.exists(outfile):
  6. os.remove(outfile)
  7. for root, dirs, files in os.walk("."):
  8. path = root[1:].split("/")
  9. wpaths.append(["/".join(path[:-1]), path[-1]])
  10. if root[1:]:
  11. for f in files:
  12. wfiles.append(root[1:] + "/" + f)
  13. wpaths = wpaths[1:]
  14. open(outfile, "w").write(json.dumps(wpaths)+",,,\n"+("\n".join(wfiles)))