blob: c2a9309b62e38b92e396a8f55a82a3b03d86045a [file] [log] [blame]
Rushabh Mehtaab7021c2015-12-03 17:52:46 +05301from __future__ import unicode_literals
2
3import os
4
5for basepath, folders, files in os.walk("user"):
6 if "index.txt" in files:
7 with open(os.path.join(basepath, "index.txt"), "r") as i:
8 in_index = i.read().splitlines()
9
10 missing = []
11
12 for f in files:
13 name = f.rsplit(".", 1)[0]
14 if name not in in_index and name != "index":
15 missing.append(f)
16
17 if missing:
18 print missing
19 with open(os.path.join(basepath, "index.txt"), "w") as i:
20 i.write("\n".join(in_index + missing))
21