need to save folder size to excel sheet.

Hi All,

I am new to PowerShell.!

Am executing below script and i would like to save all the data (Folder name, Created date, Folder size) to Excel sheet..

# Find folders
Get-ChildItem D:\PowershellScriptSearching -Recurse | Where-Object { $_.PSIsContainer } |
# Find cumulative size of the directories and put it into nice objects
ForEach-Object {
    New-Object PSObject -Property @{
        Path = $_.FullName
        Size = [Math]::Round((Get-ChildItem -Recurse $_.FullName | Measure-Object Length -Sum -ErrorAction SilentlyContinue).Sum / 1MB, 2)
    }
} |
# Exclude empty directories
Where-Object { $_.Size -gt 0 } 
# Format nicely
Format-Table -AutoSize

Could you please help me.!

February 22nd, 2015 7:49pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics