mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix progress calculation on Remove-Item (#23869)
This commit is contained in:
@@ -3121,7 +3121,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
StringUtil.Format(FileSystemProviderStrings.RemovingLocalFileActivity, _removedFiles, _totalFiles),
|
||||
StringUtil.Format(FileSystemProviderStrings.RemovingLocalBytesStatus, Utils.DisplayHumanReadableFileSize(_removedBytes), Utils.DisplayHumanReadableFileSize(_totalBytes), speed)
|
||||
);
|
||||
var percentComplete = (int)Math.Min(_removedBytes * 100 / _totalBytes, 100);
|
||||
var percentComplete = _totalBytes != 0 ? (int)Math.Min(_removedBytes * 100 / _totalBytes, 100) : 100;
|
||||
progress.PercentComplete = percentComplete;
|
||||
progress.RecordType = ProgressRecordType.Processing;
|
||||
WriteProgress(progress);
|
||||
|
||||
Reference in New Issue
Block a user