Differences

This shows you the differences between the selected revisions of the page.

2021-06-04 2022-06-16
note about using GetEnumerator once stable (martin) 5.19 was released long time ago (martin)
Line 119: Line 119:
==== [[powershell]] PowerShell ==== ==== [[powershell]] PowerShell ====
-The following code uses [[ps>threadjob/start-threadjob|''Start-ThreadJob'' cmdlet]] from ''ThreadJob'' module. It is a part of PowerShell 6 and newer. In PowerShell 5, it can be installed using ''Install-Module ThreadJob''. (*Use $files.GetEnumerator()*) &beta+The following code uses [[ps>threadjob/start-threadjob|''Start-ThreadJob'' cmdlet]] from ''ThreadJob'' module. It is a part of PowerShell 6 and newer. In PowerShell 5, it can be installed using ''Install-Module ThreadJob''.
<code powershell> <code powershell>
Line 157: Line 157:
            $session.EnumerateRemoteFiles(             $session.EnumerateRemoteFiles(
                $remotePath, $Null, [WinSCP.EnumerationOptions]::AllDirectories)                 $remotePath, $Null, [WinSCP.EnumerationOptions]::AllDirectories)
-        # An explicit implementation of IEnumerable cannot be accessed directly in PowerShell. +        $filesEnumerator = $files.GetEnumerator()
-        # WinSCP 5.18.4 has an implicit implementation, so direct $files.GetEnumerator() works. +
-········$filesEnumerator = +
- ···········[System.Collections.IEnumerable].GetMethod("GetEnumerator").Invoke($files, $Null)+
        for ($i = 1; $i -le $batches; $i++)         for ($i = 1; $i -le $batches; $i++)

Last modified: by martin