Powershell to show file count of modified files

Hey all,

I need to get a number for files modified within a 7day and 30 day period. I’m not bothered about what the file name is or date it was modified just the count.

Anybody help out?

you could use Get-ChildItem and Where-Object to look for the property ‘LastWriteTime’

Or you could search for prewritten scripts in Microsoft Technet Script Gallary

I was playing around a bit, but I believe this should do the trick:

(Get-ChildItem | where { $_.LastWriteTime -lt (Get-Date).AddDays(-7) -and $_.LastWriteTime -gt (Get-Date).AddDays(-30)} | measure).Count