1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| import os
import shutil
from time import strftime, localtime
import colorama
colorama.init()
date = strftime("%d-%m-%y", localtime())
chemin_folder_programmation = r'C:\Users\Victo\OneDrive\Documents\Python Programmation'
chemin_backup_one = r"C:\Users\Victo\Documents\Bakcup_Programmation"
chemin_backup_two = r"F:\Backup_Programmation"
backup = 0
while backup < 4:
os.system('cls')
print(colorama.Fore.YELLOW + colorama.Style.BRIGHT + '\n \n \n[Bakcup]____Dossier Python______[', date, ']\n\n')
if os.path.isdir(chemin_folder_programmation):
if os.path.isdir(chemin_backup_one):
chemin_verif = chemin_backup_one + '/' + date
if os.path.isdir(chemin_verif):
shutil.rmtree(chemin_verif)
else:
pass
chemin_f = chemin_backup_one + '/' + date + '/' + 'Programmation Python' + '/'
print('[SAUVEGARDE [1] EN COURS]\n')
shutil.copytree(chemin_folder_programmation, chemin_f)
print('[SUCCES]____Sauvegarde_[N1]______[SUCCES]\n')
else:
print('[ERREUR] Le chemin : ', chemin_backup_one, ' a été modifié ou supprimer\n')
print('[1] Recommencer')
print('[2] Quitter')
rec3 = input('_____________: ')
if rec3 == '1':
pass
else:
backup = 4
if os.path.isdir(chemin_backup_two):
chemin_verif_two = chemin_backup_two + '/' + date
if os.path.isdir(chemin_verif_two):
shutil.rmtree(chemin_verif_two)
else:
pass
chemin_f = chemin_backup_two + '/' + date + '/' + 'Programmation Python' + '/'
print('[SAUVEGARDE [2] EN COURS]\n')
shutil.copytree(chemin_folder_programmation, chemin_f)
print('[SUCCES]____Sauvegarde_[N2]______[SUCCES]\n')
print(colorama.Fore.GREEN + '[TERMINER]____FIN____[TERMINER]\n\n')
print(colorama.Fore.YELLOW + '[1] Quitter\n')
w = input('_____________: ')
if w == '1':
backup = 4
else:
backup = 4
else:
print('\n\n[ERREUR] Le chemin : ', chemin_backup_two, ' a été modifié ou supprimer')
print('[1] Recommencer')
print('[2] Quitter')
rec2 = input('_____________: ')
if rec2 == '1':
pass
else:
backup = 4
else:
print('[ERREUR] Le dossier ', chemin_folder_programmation,' a changer de nom ou a été modifier.')
print('[1] Recommencer')
print('[2] Quitter')
rec = input('_____________: ')
if rec == '1':
pass
else:
backup = 4
else:
pass |
Partager