Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

jw24

solved

Solved by using the below
$files = @($session.EnumerateRemoteFiles(
            "/pathToFolder", "*.txt", [WinSCP.EnumerationOptions]::None)|
         Where-Object { $_.LastWriteTime -lt (Get-Date).AddMinutes(-10)})
jw24

session.EnumerateRemoteFiles - only enumerate files older than x minutes

I am writing a powershell script to check whether files have been successfully processed from a SFTP site.

As part of this script i have the following:
$files = @($session.EnumerateRemoteFiles(
            "/pathToFolder", "*.txt", [WinSCP.EnumerationOptions]::None))

Is there a way to amend this so that it only enumerates files that have a CreatedTime of older than 10 minutes ago.