Hi All,
I am very new to PowerShell but love what I am seeing. I have found a great script exports the folder names, create dates, file path and file type information to a .csv file. What I really need now is to add a column that show the overall folder size including any sub directories. I don't need the sub directory names just the total for the parent and sub folders.
Can anyone help me add this to the script below? Many thanks for looking.
Here is the script
I am very new to PowerShell but love what I am seeing. I have found a great script exports the folder names, create dates, file path and file type information to a .csv file. What I really need now is to add a column that show the overall folder size including any sub directories. I don't need the sub directory names just the total for the parent and sub folders.
Can anyone help me add this to the script below? Many thanks for looking.
Here is the script
Code:
Get-ChildItem -Path E:\web -Recurse |`
foreach{
$Item = $_
$Type = $_.Extension
$Path = $_.FullName
$Folder = $_.PSIsContainer
$Age = $_.CreationTime
$Path | Select-Object `
@{n="Name";e={$Item}},`
@{n="Created";e={$Age}},`
@{n="filePath";e={$Path}},`
@{n="Extension";e={if($Folder){"Folder"}else{$Type}}}`
}|
Export-Csv E:\Web\Results.csv -NoTypeInformation