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

Advertisement

dotps1
Contributor
Joined:
Posts:
18
Location:
United States

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

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.

$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

Reply with quote

Advertisement

dotps1
Contributor
Joined:
Posts:
18
Location:
United States

Re: TransferEventArgs.Transfers is null when using WinSCP.Session.PutFiles for folders.

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.

$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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Re: TransferEventArgs.Transfers is null when using WinSCP.Session.PutFiles for folders.

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.

Reply with quote

Advertisement

You can post new topics in this forum