Here's a simple PowerShell script that should do the trick. This script will recursively calculate the size of each subfolder in a specified folder and display the results.
# Specify the root folder
$rootFolder = "C:\path\to\your\folder"
# Get all subfolders
$folders = Get-ChildItem -Path $rootFolder -Recurse -Directory
# Loop through each folder and calculate size
foreach ($folder in $folders) {
# Get all files in the folder, recursively
$files = Get-ChildItem -Path $folder.FullName -Recurse -File
You just need to replace `"C:\path\to\your\folder"` with the path to your root folder. This script will then calculate and display the size of each subfolder in that root folder.
Please note that this script calculates folder sizes by summing the sizes of all files in each folder, including files in subfolders. The size is displayed in megabytes (MB) for readability. If you prefer a different unit (like kilobytes or gigabytes), you can adjust the division factor in the `$folderSize` calculation.
Also, please be aware that calculating folder sizes can take some time for large folders or folders with many files or subfolders. The script may appear to be doing nothing while it's calculating, but it should eventually output the sizes of all subfolders. If you're dealing with particularly large folders, you might want to consider using a more efficient method or tool designed for this purpose.