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

anon1m0us

Download Today File only

I am using the script that is provided:
# Select the most recent file
$latest =
$directoryInfo.Files |
Where-Object { -Not $_.IsDirectory } |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1


# Any file at all?
if ($latest -eq $Null)
{
Write-Host "No file found"
exit 1
}

# Download the selected file
$session.GetFiles(
[WinSCP.RemotePath]::EscapeFileMask($latest.FullName), $localPath).Check()

But when I change the code to only to Today's files, and not do the latest it fails.

$directoryInfo.Files |
Where-Object { -Not $_.IsDirectory } |
get /mydocuments/* -filemask=*>Today

It does not work. Any help?