Re: Find Files
Thanks Martin, that detail is appreciated.
Session.EnumerateRemoteFiles
supports only simple Windows wildcards.
Session.GetFiles
with file mask is to query the RemoteFileInto.LastWriteTime
.
\
in the local path which was leading to the issue with retrieval.
7D
filter to this section.
$FileInfos =
$Session.EnumerateRemoteFiles(
$RemotePath, $Wildcard, [WinSCP.EnumerationOptions]::AllDirectories)
*.csv
wildcard, can I also filter this on days so I can then just retrieve all the files in $FileInfos
rather than applying the FileMask
and having to run through all the files discovered in the EnumerateRemoteFiles
section?
GetFiles
always returns False
"? GetFiles
returns an object. It cannot return False
.
Session.SessionLogPath
. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.$RemotePath = "/blah/"
$TransferOptions = New-Object WinSCP.TransferOptions
$TransferOptions.FileMask = "*/dir1/dir2/*>=7D"
$Wildcard = "*.csv"
$FileInfos =
$Session.EnumerateRemoteFiles(
$RemotePath, $Wildcard, [WinSCP.EnumerationOptions]::AllDirectories)
ForEach($File in $FileInfos){
$FilePath = [WinSCP.RemotePath]::EscapeFileMask($File.FullName)
$Session.GetFiles($FilePath, $LocalPath, $False, $TransferOptions) | Out-Null
}
GetFiles
always returns False
.
/*/dir1/dir2/*.csv>=7D
/blah