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

Advertisement

dotps1
Contributor
Joined:
Posts:
20
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.

Reply with quote

Advertisement

dotps1
Contributor

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

UPDATE: this only happens if the folder is empty.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
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