Skip to content

Receive-WinSCPItem fails if local path is a file and is missing #148

@HUMBERP

Description

@HUMBERP

Please fill in the following fields, replacing the values inside the brackets {{ }}.

Issue Description

{{ Receive-WinSCPItem fails if local path is a file and is missing, because the new code "Resolve-Path" (version 5.21.8.5) throws a terminating error if "Path" is a non existing file/path. }}

Example

{{ $TempFileName = Join-Path -Path $env:Temp -ChildPath ('{0}.tmp' -f (New-Guid).Guid)

$ReceiveResult = Receive-WinSCPItem -WinSCPSession $Parameters.WinScpSession -RemotePath $Parameters.ResolvedFileFullName
-LocalPath $TempFileName -TransferOptions $Parameters.TransferOptions
-ErrorAction Stop
}}

Expected Output

{{ File will be downloaded, even if the file is not present. }}

Actual Output

{{ TerminatingError(Resolve-Path): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path 'C:\Temp\ade27775-80c8-45fc-a654-4483df5073ea.tmp' because it does not exist." }}

WinSCP-PowerShell Version

{{
ModuleType Version PreRelease Name ExportedCommands


Script 5.21.8.5 WinSCP {ConvertTo-WinSCPEscapedString, Copy-WinSCPItem, Get-WinSCPChildItem, Get-WinSCPHostKeyFingerprint}

}}\

Environment

{{ PSVersion: 7.3.4
PSEdition: Core
GitCommitId: 7.3.4
OS: Microsoft Windows 10.0.14393
Platform: Win32NT
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.0, 7.2.0, 7.3.4
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0 }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions