Changed to a directory structure
This commit is contained in:
@@ -40,19 +40,17 @@ conn.commit()
|
||||
|
||||
folder = pathlib.Path(".")
|
||||
groups = {}
|
||||
for item in folder.glob("*.txt"):
|
||||
arr = str(item)[0:-4].split("_")
|
||||
for item in folder.rglob("*.txt"):
|
||||
arr = str(item)[0:-4].split("/")
|
||||
for i in range(len(arr)):
|
||||
groups.setdefault(i,set())
|
||||
groups[i].add(tuple(arr[:i+1]))
|
||||
|
||||
conn.commit()
|
||||
|
||||
groupids = {}
|
||||
for i in groups.keys():
|
||||
for group in groups[i]:
|
||||
name = group[-1]
|
||||
filename="_".join(group) + ".txt"
|
||||
filename="/".join(group) + ".txt"
|
||||
parentid = groupids[tuple(group[:-1])] if len(group)>1 else None
|
||||
newid = newgroup(name,parentid)
|
||||
groupids[group] = newid
|
||||
|
||||
Reference in New Issue
Block a user