Post a reply

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)


Topic review



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

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 created time of older than 10 minutes ago.