PowerShell方式:
gci -Recurse| where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)}|
select @{n="Owner";e={ get-acl $_ | select -expa owner }} | select -expa owner | group | select Count,name
编辑最后评论(powershell 3.0):
$dirs = dir -Directory
foreach ( $dir in $dirs)
{
$a = dir $dir -r -File | select @{n="Owner";e={ get-acl $_.fullname |
select -expa owner }} | select -expa owner | group | select Count,name
$a | add-member -Name Path -MemberType NoteProperty -Value $dir -PassThru
}
电源外壳 2.0:
$dirs = dir | ? { $_.psiscontainer }
foreach ( $dir in $dirs)
{
#$dir
$a = dir $dir -r |? { -not $_.psiscontainer } | select @{n="Owner";e={ get-acl $_.fullname | select -expa owner }} | select -expa owner | group | select Count,name
$a | add-member -Name Path -MemberType NoteProperty -Value $dir -PassThru
}