Allow creation of machine specific configs.
This commit is contained in:
14
backup.py
14
backup.py
@@ -146,9 +146,19 @@ def local_backup(output_dir: Path, backup_name: str, inputs: list, ignore_patter
|
||||
|
||||
def backup_all():
|
||||
config_dir = Path(__file__).parent / "configs"
|
||||
config_files = sorted(config_dir.glob("*"))
|
||||
print(config_files)
|
||||
# Get all JSON files except the example config
|
||||
config_files = sorted([f for f in config_dir.glob("*.json") if f.name != "example-config.json"])
|
||||
|
||||
if not config_files:
|
||||
print("No configuration files found. Please create a config file in the 'configs' directory.")
|
||||
print("You can copy the example-config.json to create your own configuration:")
|
||||
print("cp configs/example-config.json configs/my-backup.json")
|
||||
return
|
||||
|
||||
print(f"Found {len(config_files)} config files: {[f.name for f in config_files]}")
|
||||
|
||||
for file in config_files:
|
||||
print(f"\nProcessing backup configuration: {file.name}")
|
||||
text = file.read_text()
|
||||
config = json.loads(text)
|
||||
output_dir = Path(config["outputDir"]).expanduser().resolve()
|
||||
|
||||
Reference in New Issue
Block a user