1 #!/usr/local/bin/python3.0
10 if not os.path.exists("data/07"):
11 os.makedirs("data/07")
13 treg = re.compile("^data/06/[0-9a-f]{2,2}/[0-9a-f]{32,32}/([^/]+)$")
15 for path, dirs, files in os.walk("data/06"):
17 tfile = os.path.join(path, file)
18 match = treg.match(tfile)
20 idfiles[match.group(1)] = tfile
21 print("Idfiles isolated: %d" % len(idfiles))
24 for path, dirs, files in os.walk("data/07"):
25 groupfiles.update({(path.rsplit('/', 1)[1] + "_" + file):os.path.join(path, file) for file in files})
26 print("Groupfiles isolated: %d" % len(groupfiles))
29 touchfiles = sorted(set([tag for tag in idfiles.keys()]) | set([tag for tag in groupfiles.keys()]))
31 trarg = re.compile("^([^_]+)_([^_]+)$")
33 for tag in touchfiles:
34 assert(tag in idfiles)
35 if not tag in groupfiles:
36 print("Linking %s" % tag)
37 match = trarg.match(tag)
38 id, ts = match.group(1), match.group(2)
39 if not os.path.exists("data/07/%s/%s" % (id[0:2], id)):
40 os.makedirs("data/07/%s/%s" % (id[0:2], id))
41 os.link(idfiles[tag], "data/07/%s/%s/%s" % (id[0:2], id, ts))