I have a known-good PowerShell script which uses the WinSCP .NET component. I added a new function to move successfully uploaded files to an archive folder, and it blew-up on me. I think I have identified the problem, related to the
parameter. I have listed the pertinent commands below; I skipped all the other stuff but I can post more detail if you're unable to recreate the problem.
$TransferResult = $Session.PutFiles("$($Transfer)", "$($Transfer)", $DeleteAfterTransfer, $transferOptions)
$FilesToArchive = Get-ChildItem $TransferResult.Transfers.FileName
The problem occurs when there are files in the local source dir but they are skipped because they already exist in the remote target (the
Session option). In this situation I am expecting the
method to return a null – but instead it returned the contents of the current script directory. So my testing resulted in the upload script etc all being moved into the upload-file archive; oops
Can you verify if this is a bug in the
Is there a better way for me to check which files were, in fact, transferred?
Thank you for your assistance.