From 6bca7a0f0cd693aaf29b8d9684e4f4c8f30f1190 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Tue, 26 Nov 2024 15:59:03 +0700 Subject: [PATCH] Create backup_data.py --- QuantumNexusProtocol/backup_data.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 QuantumNexusProtocol/backup_data.py diff --git a/QuantumNexusProtocol/backup_data.py b/QuantumNexusProtocol/backup_data.py new file mode 100644 index 000000000..48c4e25ad --- /dev/null +++ b/QuantumNexusProtocol/backup_data.py @@ -0,0 +1,16 @@ +import shutil +import os +from datetime import datetime + +def backup_data(): + source_dir = "/path/to/blockchain/data" + backup_dir = f"/path/to/backup/{datetime.now().strftime('%Y%m%d_%H%M%S')}" + + try: + shutil.copytree(source_dir, backup_dir) + print(f"Backup completed successfully to {backup_dir}.") + except Exception as e: + print("Error during backup:", e) + +if __name__ == "__main__": + backup_data()