diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs index 70cd27a9..57ba55b1 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs @@ -241,12 +241,14 @@ internal class DirectoryProviderService : IDirectoryProviderService string destFilePath = _fileSystem.Path.Combine(destDir, fileName); // if a file with the same name exists in the destination if (_fileSystem.File.Exists(destFilePath)) + { if (overwrite) { // overwrite the file in the destination directory _fileSystem.File.Delete(destFilePath); _fileSystem.File.Move(sourceFilePath, destFilePath); } + } else _fileSystem.File.Move(sourceFilePath, destFilePath); // move the file if it does not exist in the destination directory }