Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using PowerShell how can I count the number of files that each owner has modified in the last 45 days?

This is how I am able to get counts by extension in the last 45 days:

gci -Recurse| where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)}| group Extension -NoElement

Instead of grouping by extension, I would like to group and count by owner. Thank you for your guidance!

Please note that this is counting through an entire directory structure

share|improve this question
add comment

1 Answer 1

gci -recurse | where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)} | % { get-acl $_ } | group Owner -NoElement

Will get you all the permissions, grouped by owner. Just remove the last pipe if you want them ungrouped.

i.e:

gci -recurse | where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)} | % { get-acl $_ }
share|improve this answer
    
thanks so much! now can i ask you, how can i run this script once for every directory in a parent directory. for example if i am in parent\, and parent dir has dir a, dir b, dir c, i want to run it once for each of those dirs? –  Yuck Feb 1 '13 at 20:35
    
and is there a way for it to not display details on every file, only the summary? –  Yuck Feb 1 '13 at 20:40
    
Setting -recursive on gci already runs it for all directories. If you only want to run it for one specific parent directory, just set the name of that dir. e.g: gci nameOfDir -recurse |... If you want to see the count of how many items are owned by a specific owner, just use the first script (I assume that's what you mean by "Summary") –  malgca Feb 1 '13 at 21:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.