Re: Session.GetFileToDirectory Not creating local directory if it doesn't exist
Thanks for your report. Indeed, the documentation is wrong. I've removed that statement.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
foreach ($fileInfo in $Files){
Write-Host "Downloading $($fileInfo.FullName) ..."
$filePath = [WinSCP.RemotePath]::EscapeFileMask($fileInfo.FullName)
$FileFullNameBS = $fileInfo.FullName.Replace("/", "\")
$sp = Split-Path -Path $FileFullNameBS
$LocalDirectory = "$($localPath)$($sp)"
$session.GetFileToDirectory($filePath, $LocalDirectory, $false)
}
Exception calling "GetFileToDirectory" with "3" argument(s): Local Directory
At localfilepath\txtmerge.ps1:69 char:5
+ $session.GetFileToDirectory($filePath, $LocalDirectory, $false)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DirectoryNotFoundException
If the target local directory does not exist, it is created.