Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

You were possibly overwriting your $transferOptions variable elsewhere in your code.
NottaSmartMan

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.
NottaSmartMan

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