Help transferring files using wildcards in PowerShell
I'm having a heck of a time getting this to work. I have a folder on an AIX system (/data/STORAGE/_HOLD_) with files that need to be transferred to a folder on my local system (C:\ToProcess).
I need to transfer only the files starting with "90_FINISH.CHECKS.ISSUED_" and "90_FINISH.AP.DETAILS_".
The code I have thus far is:
Once this completes, a new empty folder is created under C:\ToProcess, but no files. I need the files in the root of that folder, not in a "_HOLD_" subfolder.
Help please!
I need to transfer only the files starting with "90_FINISH.CHECKS.ISSUED_" and "90_FINISH.AP.DETAILS_".
The code I have thus far is:
$SessionOptions.DisableVersionCheck $sessionOptions = New-Object WinSCP.SessionOptions $sessionOptions.Protocol = [WinSCP.Protocol]::sftp $sessionOptions.HostName = "host" $sessionOptions.UserName = "user" $sessionOptions.Password = "password" $sessionOptions.SshHostKeyFingerprint = "XXXXXX" $session = New-Object WinSCP.Session $session.Open($sessionOptions) $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.FileMask = "|90_FINISH.CHECKS.ISSUED_*","|90_FINISH.AP.DETAILS_*" $transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off $sourcepath = "/data/STORAGE/_HOLD_" $destpath = "c:\ToProcess\" $session.PutFiles($sourcepath, $destpath, $True, $transferOptions)
Once this completes, a new empty folder is created under C:\ToProcess, but no files. I need the files in the root of that folder, not in a "_HOLD_" subfolder.
Help please!