Parallel Transfers + TransferOptions

Advertisement

NottaSmartMan
Joined:
Posts:
36

Parallel Transfers + TransferOptions

I'm experimenting with your PowerShell code to allow for Parallel Transfers. As part of my testing, I'm purposely trying to have the script copy files that I've stumbled with in the past.

One of the test involves files with hex code in the filename. IE: A file named: Test.%7C
In my previous code, the fixed was to add the transfer option of
AddRawSettings("ReplaceInvalidChars", "0")
However, using the code at https://winscp.net/eng/docs/library_example_parallel_transfers and under the Synchronization/PowerShell block as my starting point, I can't figure out how/where to add it.

Do you have any tips?
I tried changing the line:
$difference.Resolve($syncSession) | Out-Null
to
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off
$transferOptions.AddRawSettings("ReplaceInvalidChars", "0")
    
$difference.Resolve($syncSession,$transferOptions) | Out-Null
But that didn't work. I still get errors such as
Error: Exception calling "Resolve" with "1" argument(s): "Cannot create remote file '/server/Problem Files/Test.|'.
Thank you

Reply with quote

Advertisement

NottaSmartMan
Joined:
Posts:
36

Yes, I was passing $transferOptions to the Compare function as well. After toying around with things, I was able to get things working by using a variable name other than $transferOptions. I don't fully understand why this matter, but it works.

New code is:
$transferOptionsForThreads = New-Object WinSCP.TransferOptions
$transferOptionsForThreads.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off
$transferOptionsForThreads.AddRawSettings("ReplaceInvalidChars", "0")
$difference.Resolve($syncSession, $transferOptionsForThreads) | Out-Null
I did run into another issue where IgnorePermErrors doesn't appear to be taking effect for me, but I'll open a new thread for that to ensure this thread stays clean.

I'll be attaching my code privately as well in case you have any questions regarding this thread or the other.

Reply with quote

Advertisement

You can post new topics in this forum