Powershell – get new files, i.e. files less than x day old

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

<pre>
$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)" 
</pre>

Uncategorized  

Leave a Reply