Topic "TransferEventArgs.Transfers is null when using WinSCP.Session.PutFiles for folders."

Author Message
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 15
Location: United States
When i use the the WinSCP.Session.PutFiles() method to transfer a folder, the TransferEventArgs.Transfers property is null. It seems to work fine with a file.

Code:

$so = New-Item -TypeName WinSCP.SessionOptions
$so.HostName = 'locallhost'
$so.UserName = 'Guest'
$so.Protocol = 'Ftp'

$s = New-Item -TypeName WinSCP.Session

$s.Open($so)

$results = $s.PutFiles('C:\TempFolder', './')


PS C:\> $results

Transfers Failures IsSuccess
--------- -------- ---------
{}        {}            True



i would like to use the $results.FileName and $results.Destination for other things.

thanks.
_________________
https://github.com/dotps1
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 15
Location: United States
dotps1 wrote:
When i use the the WinSCP.Session.PutFiles() method to transfer a folder, the TransferEventArgs.Transfers property is null. It seems to work fine with a file.

Code:

$so = New-Item -TypeName WinSCP.SessionOptions
$so.HostName = 'locallhost'
$so.UserName = 'Guest'
$so.Protocol = 'Ftp'

$s = New-Item -TypeName WinSCP.Session

$s.Open($so)

$results = $s.PutFiles('C:\TempFolder', './')


PS C:\> $results

Transfers Failures IsSuccess
--------- -------- ---------
{}        {}            True



i would like to use the $results.FileName and $results.Destination for other things.

thanks.


UPDATE: this only happens if the folder is empty.
_________________
https://github.com/dotps1
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
The TransferOperationResult.Transfers includes only files. If you "upload" an empty folder, there are no files.

It's consistent with the case the folder is not empty. The collection will include files in the folder, but not the folder itself.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License