Re: Powershell script to loop through a txt file to copy files
I'm not a PowerShell expert, so I cannot tell why your original approach with "$remotePath/$_" did not work. What was a full error message you were getting?
Anyway your new approach with
Consider trying
Also note that you should (with either approach) pass the
https://winscp.net/eng/docs/library_remotepath_escapefilemask
Anyway your new approach with
FileMask
is pretty ineffective.
Consider trying
$transferResult = $session.GetFiles("$remotePath/$fileName", $localPath_out , $False, $transferOptions)
Also note that you should (with either approach) pass the
$fileName
through RemotePath.EscapeFileMask
:
https://winscp.net/eng/docs/library_remotepath_escapefilemask