$dir = "\\server\BackupBuddy"
Get-ChildItem $dir -Recurse -Directory |
ForEach-Object{
[pscustomobject]@{
Folder = $_.Name
Count = @(Get-ChildItem -Path $_.fullname -File).Count
}
} | Select-Object Folder,Count
如果文件也经过至少2天的过滤,那就更好了。 谢谢,我是新来的。
答案 0 :(得分:0)
只需将LastWriteTime
属性添加到您的pscustomobject
和Select-Object
$dir = "\\server\BackupBuddy"
Get-ChildItem $dir -Recurse -Directory |
ForEach-Object{
[pscustomobject]@{
Folder = $_.Name
Count = @(Get-ChildItem -Path $_.fullname -File).Count
LastWriteTime = $_.LastWriteTime
}
} | Select-Object Folder,LastWriteTime,Count