You can use PowerShell to achieve this by using the Get-ChildItem
cmdlet to retrieve information about folders, and then select the properties you want to display. You can then format the output to display the information in a single line.
Here's how you can do it:
Get-ChildItem -Directory | ForEach-Object { $_.Name + " | " + $_.LastWriteTime + " | " + "{0:N2} MB" -f ((Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB) }
Let's break down what this script does:
Get-ChildItem -Directory
: This cmdlet retrieves all the directories (folders) in the current directory.ForEach-Object
: This cmdlet allows you to perform an operation on each directory returned by Get-ChildItem
.$_
: Represents the current directory being processed in the loop.Name
: Retrieves the name of the directory.LastWriteTime
: Retrieves the last write time of the directory."{0:N2} MB" -f ((Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB)
: This part calculates the total size of the directory (including subdirectories) in megabytes. It uses the Get-ChildItem
cmdlet with the -Recurse
parameter to get all files in the directory and its subdirectories, then pipes them to the Measure-Object
cmdlet to calculate the sum of their lengths. Finally, it divides the sum by 1MB
to convert it to megabytes and formats the output to display two decimal places.This script will output each folder's name, last write time, and size in megabytes in a single line for each folder. You can adjust the formatting or add additional properties as needed.
Powershell: List folders with name, last write time, and size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: Show folder details - name, last modified date, size
Get-ChildItem | Where-Object { $_.PSIsContainer } | ForEach-Object { $_ | Add-Member -MemberType NoteProperty -Name "Size" -Value (Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum; $_ } | Select-Object Name, LastWriteTime, Size | Format-Table -AutoSize
Powershell: Display folder properties - name, last modified, size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: List directory names, last write date, and size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: Get folders with name, last write time, and size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: Show folder info - name, last modified, size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: List directories with name, last write time, and size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: View folder details - name, last modified, size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: Display folders with name, last write time, and size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
Powershell: List folder properties - name, last modified, size
Get-ChildItem | Where-Object { $_.PSIsContainer } | Select-Object Name, LastWriteTime, @{Name="Size";Expression={(Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum}} | Format-Table -AutoSize
label pytorch chmod angular-ngfor google-sheets-macros type-conversion core-animation vsto azure-configuration react-functional-component