sync: change save and restore function parameters

This commit is contained in:
GaspardCulis 2024-01-05 14:31:49 +01:00
parent d4c51eaaa6
commit 03cb30d5ed

22
sync
View file

@ -45,22 +45,22 @@ synced_files = [
] ]
def save(): def save(fd: tuple[str, str]):
for p in synced_files: folder = "/".join(fd[0].split("/")[0:-1])
folder = "/".join(p[0].split("/")[0:-1]) if not os.path.exists(folder):
if not os.path.exists(folder): os.mkdir(folder)
os.mkdir(folder) os.system(f"rsync -r {fd[1]} {fd[0]}")
os.system(f"rsync -r {p[1]} {p[0]}")
def restore(): def restore(fd: tuple[str, str]):
for p in synced_files: os.system(f"rsync -r {fd[0]} {fd[1]}")
os.system(f"rsync -r {p[0]} {p[1]}")
if __name__ == "__main__": if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
if args.action == "save": if args.action == "save":
save() for p in synced_files:
save(p)
elif args.action == "restore": elif args.action == "restore":
restore() for p in synced_files:
restore(p)