From ab0874358014f4ed62dc8c854116944c781329e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:49:56 +0000 Subject: [PATCH 1/2] Initial plan From 1d88382e5690f3edf0bdfdf234b42b20a748299e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:52:58 +0000 Subject: [PATCH 2/2] Enhance folder size script with file/folder counts and optimized performance Co-authored-by: jasrasr <92162022+jasrasr@users.noreply.github.com> --- ...all-folder-size-with-child-items-in-mb.ps1 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/File-Management-Scripts/get-overall-folder-size-with-child-items-in-mb.ps1 b/File-Management-Scripts/get-overall-folder-size-with-child-items-in-mb.ps1 index 154b0b4..ca6175c 100644 --- a/File-Management-Scripts/get-overall-folder-size-with-child-items-in-mb.ps1 +++ b/File-Management-Scripts/get-overall-folder-size-with-child-items-in-mb.ps1 @@ -8,11 +8,26 @@ $projectfolders = @( # Loop through each folder and calculate the total size foreach ($projectfolder in $projectfolders) { if (Test-Path $projectfolder) { - $folderSize = (Get-ChildItem -Path $projectfolder -Recurse | Measure-Object -Property Length -Sum).Sum + # Store Get-ChildItem results in a variable to optimize performance + $items = Get-ChildItem -Path $projectfolder -Recurse + + # Calculate total size + $folderSize = ($items | Measure-Object -Property Length -Sum).Sum $folderSizeMB = [math]::Round($folderSize / 1MB, 2) - Write-Output "Total size of $projectfolder : $folderSizeMB MB" + + # Count files and folders + $fileCount = ($items | Where-Object { -not $_.PSIsContainer }).Count + $folderCount = ($items | Where-Object { $_.PSIsContainer }).Count + + # Display information in structured format + Write-Output "Folder: $projectfolder" + Write-Output " Total size: $folderSizeMB MB" + Write-Output " Files: $fileCount" + Write-Output " Folders: $folderCount" + Write-Output "" } else { Write-Output "Folder $projectfolder does not exist." + Write-Output "" } }