import pathlib, os
files = []
paths = []
def get_file_names(firstpath, path=""):
    global files, paths
    for elem in pathlib.Path(f"{firstpath}/{path}").iterdir():
        if elem.is_file():
            if path:
                files.append(f"{path}/{elem.name}")
            else:
                files.append(f"{elem.name}")
        else:
            if path:
                paths.append(f"{path}/{elem.name}")
                get_file_names(firstpath, f"{path}/{elem.name}")
            else:
                paths.append(f"{elem.name}")
                get_file_names(firstpath, f"{elem.name}")
            
            
get_file_names("Updates", path="")
#print(files)
inifile = open("updatescript.ini", "w")
inifile.write("""releases{
0.1
0.2
}
release:0.1{
}
release:0.2{
""")
for path in paths:
    inifile.write(f"CreateDirectory:[MyInstallPath]/{path}\n")

for file in files:
    inifile.write(f"DownloadFile:{file},[MyInstallPath]/{file}\n")
inifile.write("}")
inifile.close()