Re: LastWriteTime of directory
The
You have to use
Session.EnumerateRemoteFiles
supports only trivial file masks, definitely not time constraints.
You have to use
RemoteFileInfo.LastWriteTime
to select the desired folders:
$limit = [System.DateTime]::Today.AddDays(-1)
$opts =
[WinSCP.EnumerationOptions]::AllDirectories -bor
[WinSCP.EnumerationOptions]::EnumerateDirectories
$files =
$session.EnumerateRemoteFiles(
$remotePath, $Null, $opts) |
Where-Object { $_.IsDirectory -and ($_.LastWriteTime -gt $limit) } |
Select-Object -ExpandProperty FullName