DEV Community

Chris Fleischhacker
Chris Fleischhacker

Posted on • Originally published at chrisfleischhacker.wordpress.com on

PowerShell List Files Changed in the Last 7 Days

$startingpath=”C:\”

$startingdate=$(Get-Date).AddDays(-7)

Get-Childitem $startingpath -Recurse | where-object {!($_.psiscontainer)} | where { $_.LastWriteTime -gt $startingdate } | foreach { Write-Host “$($_.LastWriteTime) :: $($_.Fullname) ” }

OR

foreach {Write-Output “$($_.LastWriteTime) :: $($_.Fullname) ” >> changedfiles.csv }

Top comments (0)