ListDirectory.Files does not return collection when only one matching file
Code:
$directoryInfo = $session.ListDirectory($somePath)
$files = $directoryInfo.Files
When there is more than one file in $somePath, $files correctly contains a collection (RemoteFileInfoCollection) of files and $files.Length returns the number of files in the collection.
Problem:
When there is only one file in $somePath, $files contains a single File object instead of a collection of one file. $files.Length returns the size of the file.
Using: SFTP, WinSCP 5.7.3 on Windows 8.1 and PowerShell
$directoryInfo = $session.ListDirectory($somePath)
$files = $directoryInfo.Files
When there is more than one file in $somePath, $files correctly contains a collection (RemoteFileInfoCollection) of files and $files.Length returns the number of files in the collection.
Problem:
When there is only one file in $somePath, $files contains a single File object instead of a collection of one file. $files.Length returns the size of the file.
Using: SFTP, WinSCP 5.7.3 on Windows 8.1 and PowerShell