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

martin

Re: Help transferring files using wildcards in PowerShell

You are welcome. Thanks for considering a donation to our project!
doughorton

Re: Help transferring files using wildcards in PowerShell

martin wrote:

$transferOptions.FileMask = "90_FINISH.CHECKS.ISSUED_*,90_FINISH.AP.DETAILS_*"
...
$sourcepath = "/data/STORAGE/_HOLD_/*"


That worked. Thanks! By the way, I am going to get approval from my boss to make a donation. You have been very helpful on several occasions, and I much appreciate it.
martin

Re: Help transferring files using wildcards in PowerShell

$transferOptions.FileMask = "90_FINISH.CHECKS.ISSUED_*,90_FINISH.AP.DETAILS_*"
...
$sourcepath = "/data/STORAGE/_HOLD_/*"
doughorton

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:

$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!