Re: Problems downloading file with "]" character in name
Your code does not demonstrate the problem. You never use the
Anyway, in general, use
https://winscp.net/eng/docs/library_remotepath_escapefilemask
Or use
https://winscp.net/eng/docs/library_session_getfiletodirectory
(don't use
$targetFileName
variable. Also, the problem is left bracket ([
), not right (]
), right?
Anyway, in general, use
RemotePath.EscapeFileMask
:
https://winscp.net/eng/docs/library_remotepath_escapefilemask
Or use
Session.GetFileToDirectory
instead of Session.GetFiles
.
https://winscp.net/eng/docs/library_session_getfiletodirectory
(don't use
GiveUpSecurityAndAcceptAnySshHostKey
, unless you understand and accept the security consequences).