diff --git a/app/specs/spec.py b/app/specs/spec.py index 35481ae..8e57093 100644 --- a/app/specs/spec.py +++ b/app/specs/spec.py @@ -45,10 +45,13 @@ class Spec: destination if type(destination) == Path else Path(destination) ) - # Check existence of destination folder - if not self.destination.exists() or not self.destination.is_dir(): + # Create destination if non-existent + try: + self.destination.mkdir(parents=True, exist_ok=True) + + except FileExistsError: raise NotADirectoryError( - "{} doesn't exist or isn't a directory.".format( + "{} already exists, but isn't a directory.".format( self.destination ) ) diff --git a/backups.yaml b/backups.yaml index fb8104c..e82340e 100644 --- a/backups.yaml +++ b/backups.yaml @@ -36,6 +36,6 @@ specs: directories: test: - destination: "/home/jjr/test" + destination: "/tmp/to" limit: 5 - source: "/home/jjr" + source: "/tmp/from" diff --git a/backups_test.yaml b/backups_test.yaml deleted file mode 100644 index 2249ec3..0000000 --- a/backups_test.yaml +++ /dev/null @@ -1,14 +0,0 @@ -defaults: - directories: - notify: - title: 'yeet' - events: - - 'random' - - limit: 7 - -specs: - directories: - test: - source: '/tmp/from' - destination: '/tmp/to'