mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
@ -203,7 +203,10 @@ class GdriveSync(plugins.Plugin):
|
|||||||
if os.path.isfile(src_path):
|
if os.path.isfile(src_path):
|
||||||
# If it's a file, copy it to the destination preserving the directory structure
|
# If it's a file, copy it to the destination preserving the directory structure
|
||||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||||
shutil.copy2(src_path, dest)
|
# Check if the destination file already exists
|
||||||
|
if os.path.exists(dest):
|
||||||
|
# If it exists, remove it to overwrite
|
||||||
|
os.remove(dest)
|
||||||
elif os.path.isdir(src_path):
|
elif os.path.isdir(src_path):
|
||||||
# If it's a directory, copy the entire directory to the destination
|
# If it's a directory, copy the entire directory to the destination
|
||||||
shutil.copytree(src_path, dest)
|
shutil.copytree(src_path, dest)
|
||||||
@ -217,7 +220,7 @@ class GdriveSync(plugins.Plugin):
|
|||||||
zip_file = self.drive.CreateFile({'title': 'backup.zip', 'parents': [{'id': gdrive_folder}]})
|
zip_file = self.drive.CreateFile({'title': 'backup.zip', 'parents': [{'id': gdrive_folder}]})
|
||||||
|
|
||||||
# Set the content of the file to the zip file
|
# Set the content of the file to the zip file
|
||||||
zip_file.SetContentFile(os.path.join(backup_path, 'backup.zip'))
|
zip_file.SetContentFile(backup_path)
|
||||||
|
|
||||||
# Upload the file to Google Drive
|
# Upload the file to Google Drive
|
||||||
zip_file.Upload()
|
zip_file.Upload()
|
||||||
|
Reference in New Issue
Block a user