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: SFTP PUT wild card xml files

You have to use two Session.PutFiles calls, one for "rabbit*.xml" and one "bunny*.xml", if that's what you ask for.

Another option is to use TransferOptions.FileMask with "rabbit*.xml; bunny*.xml", which would allow you to use one call only.
Naughtikus

SFTP PUT wild card xml files

Hello all.

I found example from https://winscp.net/eng/docs/script_locking_files_while_uploading to use for our uploads to remote server. However I need to send out two (or later possible more) type of xml files. Lets call them rabbit*.xml and bunny*.xml.

If its just this... works fine...
$session.PutFiles(($localPath + "*.xml"), ($remotePath + "*.*" + $suffix),
                $False, $transferOptions)

But when I try to add in that rabbit*.xml AND bunny*.xml I start getting different types of errors. Especially if there are no files in the local directories. So 1) how to make it 0 (not error) even if there are no files in the local directory and b) can I add in more than one file names here or should I do another
$transferResult =
    $session.PutFiles(($localPath + "bunny*.txt"), ($remotePath + "*.*" + $suffix),
        $False, $transferOptions)

Under the first one?

Thanks!