From 9e8a5cc033f83627d5f91a74d4bd2aee6b2f82f0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 19 Oct 2023 15:03:42 -0700 Subject: [PATCH] Fix `Copy-Item` progress to only show completed when all files are copied (#20517) (#20544) --- .../namespaces/FileSystemProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 5704773b7..7236a6f38 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -3569,7 +3569,7 @@ namespace Microsoft.PowerShell.Commands } CopyItemLocalOrToSession(path, destinationPath, recurse, Force, null); - if (_totalFiles > 0) + if (Stopping || _copiedFiles == _totalFiles) { _copyStopwatch.Stop(); var progress = new ProgressRecord(COPY_FILE_ACTIVITY_ID, " ", " ");