Posted: 2015-12-01 23:02
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 (184.108.40.206) does not match version of this assembly Sync\Bin\WinSCPnet.dll (220.127.116.11). 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,
Location: Prague, Czechia
The brackets have a special meaning in the filemask.
If you need to use a literal file name, you have to escape it by passing the name though
Posted: 2015-12-03 16:37
Thanks for the information ! I'll try this !
Edit : I made the change, it's works perfectly ! Thanks for the answer !
You can post new topics in this forum
And it's free!