24 lines
1014 B
Python
Executable File
24 lines
1014 B
Python
Executable File
#! /usr/bin/env python3
|
|
|
|
import os, shutil, dirsync
|
|
|
|
backup_folders = [
|
|
os.path.join(os.sep, "home", "jonnybravo", "Projekte", "Schulung_Docker_k8s"),
|
|
os.path.join(os.sep, "home", "jonnybravo", "Projekte", "create_wireguard")
|
|
]
|
|
|
|
dest_backup = os.path.join(os.sep, "home", "jonnybravo", "Projekte", "backup_dest")
|
|
|
|
for folder in backup_folders:
|
|
try:
|
|
add_des_last_folder = dest_backup + os.sep + os.path.split(folder)[1]
|
|
if os.path.exists(add_des_last_folder):
|
|
output_dirsync = dirsync.sync(sourcedir=folder, targetdir=add_des_last_folder, action='sync')
|
|
else:
|
|
#full_dest_folder = dest_backup + "/" + last_folder[1]
|
|
destination = shutil.copytree(src=folder, dst=add_des_last_folder, dirs_exist_ok=True)
|
|
except:
|
|
raise PermissionError("Schau dir mal die berechtigungen an da stimmt was nicht")
|
|
finally:
|
|
output = folder + " wurde angelegt oder gesynct !!!"
|
|
print("#" * len(output), output, "#" * len(output), sep="\n") |