Directory contents are empty
                Hi,
I'm using the standalone WinSCP with the .NET/Powershell extension in a powershell script. It works reasonably well, but there is sometimes a directory that WinSCP report as being empty (only consisting of ".."), when it is not.
Here is the example code I use:
    
Curiously enough, when I ran most of this script by typing out lines (instead of running the script containing them), I think that directory's contents were shown to be correct. So I'm a little confused. Does anyone see any problem with the above code?
            
        I'm using the standalone WinSCP with the .NET/Powershell extension in a powershell script. It works reasonably well, but there is sometimes a directory that WinSCP report as being empty (only consisting of ".."), when it is not.
Here is the example code I use:
. .\common.ps1
try
{
   Add-Type -Path "..\WinSCPnet.dll"
 
    # Setup session options
    $sessionOptions = New-Object WinSCP.SessionOptions
    $sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
    $sessionOptions.HostName = "ftp.domain.com"
    $sessionOptions.UserName = "UserName"
    $sessionOptions.Password = "Password"
    $sessionOptions.SshHostKeyFingerprint = "ssh-dss 1024 asdfasdfasdfasdfasd random asdfasdfasdf"
   
   try
   {
      # Connect
      $session = New-Object WinSCP.Session
      $session.Open($sessionOptions)
      $directoryInfo = $session.ListDirectory("/remote/directory/path")
      $dirFiles = $directoryInfo.Files
      #$dirFiles would only contain ".." if I iterated over it
   }
   finally
   {
      # Disconnect, clean up
      $session.Dispose()
   }
    exit 0
}
catch [Exception]
{
    $_.Exception.Message | out-file $outputFp -encoding ascii -append
    exit 1
}Curiously enough, when I ran most of this script by typing out lines (instead of running the script containing them), I think that directory's contents were shown to be correct. So I'm a little confused. Does anyone see any problem with the above code?