mirror of
https://codeberg.org/vlw/cloud-backup.git
synced 2025-09-13 17:43:42 +02:00

* wip(22w9a): sql param fix * wip(22w9b): add azure * wip(22w9c): add single item backup * wip(22w10a): add logger * wip(22w11a): add aws support * Update README.md
31 lines
No EOL
599 B
Python
31 lines
No EOL
599 B
Python
import sys
|
|
|
|
from src import Backup, file_exists
|
|
|
|
# Back up a single file by path
|
|
def file_backup():
|
|
path = sys.argv[2]
|
|
|
|
if len(sys.argv) < 3:
|
|
return print("Invalid argument length: Expected path to file or folder")
|
|
|
|
if not file_exists(path):
|
|
return print(f"File or folder at '{path}' does not exist")
|
|
|
|
return Backup().backup_item(path, False)
|
|
|
|
def run(method):
|
|
methods = {
|
|
"file": file_backup,
|
|
"all" : Backup().backup_all
|
|
}
|
|
|
|
if method not in methods:
|
|
return print(f"Invalid argument '{method}'")
|
|
|
|
return methods[method]()
|
|
|
|
if len(sys.argv) > 1:
|
|
run(sys.argv[1])
|
|
else:
|
|
run("all") |