Powershell to show file count of modified files

This topic contains 2 replies, has 3 voices, and was last updated by  Jos Lemmerling 1 year, 7 months ago.

  • Author
  • #56357

    Jay V

    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?

  • #56359

    Olaf Soyk

    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

  • #56434

    Jos Lemmerling

    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

You must be logged in to reply to this topic.