diff --git a/app/classes/shared/file_helpers.py b/app/classes/shared/file_helpers.py index 23bf01dd..4fcd0c21 100644 --- a/app/classes/shared/file_helpers.py +++ b/app/classes/shared/file_helpers.py @@ -183,8 +183,7 @@ class FileHelpers: @staticmethod def move_dir(src_path, dest_path): - FileHelpers.copy_dir(src_path, dest_path) - FileHelpers.del_dirs(src_path) + shutil.move(src_path, dest_path) @staticmethod def move_dir_exist(src_path, dest_path): @@ -193,8 +192,7 @@ class FileHelpers: @staticmethod def move_file(src_path, dest_path): - FileHelpers.copy_file(src_path, dest_path) - FileHelpers.del_file(src_path) + shutil.move(src_path, dest_path) @staticmethod def make_archive(path_to_destination, path_to_zip, comment=""): diff --git a/app/migrations/20240308_multi-backup.py b/app/migrations/20240308_multi-backup.py index db154ec8..bc6dc373 100644 --- a/app/migrations/20240308_multi-backup.py +++ b/app/migrations/20240308_multi-backup.py @@ -175,12 +175,10 @@ def migrate(migrator: Migrator, database, **kwargs): Helpers.ensure_dir_exists( os.path.join(server.backup_path, new_backup.backup_id) ) - for file in os.listdir(server.backup_path): - if not os.path.isdir(os.path.join(os.path.join(server.backup_path, file))): - FileHelpers.move_file( - os.path.join(server.backup_path, file), - os.path.join(server.backup_path, new_backup.backup_id, file), - ) + FileHelpers.move_dir( + os.path.join(server.backup_path), + os.path.join(server.backup_path, new_backup.backup_id), + ) Console.debug("Migrations: Dropping old backup table") # Drop the existing backups table