How to get files created in the most recent x days.

$days = -3 
$folderMask = "c:\BizTalk\Vendors\*\AS2FilesReceived\*.*"
$files = Get-ChildItem -Path $folderMask -File | Where-Object {$_.CreationTime -gt (Get-Date).AddDays($days)} | Sort-Object FullName
Write-Host "Number of New AS2 Files = $($files.Count)" 

Filed under: Powershell