I use a powershell script to download automatically files from several directories from a remote debian server (SFTP).
In the remote directory, I can have file directly, or sub directories with files. In the second case, I want to kept the directory structure once downloaded.
I use getFiles(remotePath, localPath) to retrieve remote content one by one (I have to make somes tests on the remote content, all of them are not to download), without paying attention if remote content is a file or a directory. WinSCP download both very well and kept the structure.
It's works very well most of the time, but I discover yesterday than if the remotePath string is a directory with a [ inside of the name, the download fail without error.
Downloadresult.issuccess is true, but the direcotry haven't been downloaded ...
I force UTF8 with $sessionOptions.AddRawSettings("Utf","1"), but it doesn't change anything.
I also update my winSCP to last version, but it still fail.
For information, it seem to have a problem with the last package, I got the following error message with this package :
The version of Sync\Bin\WinSCP.exe (220.127.116.11) does not match version of this assembly Sync\Bin\WinSCPnet.dll (18.104.22.168). You can disable this check using Session.DisableVersionCheck (not recommended).
So I disable the check with $session.DisableVersionCheck = "true"
How should I manage the directory name with brackets ?
Thanks for your help,