Winscp 5.1.5 .Net library removes files after downloading

Advertisement

dimic
Joined:
Posts:
4

Winscp 5.1.5 .Net library removes files after downloading

Hi!
I use Powershell with WinSP library ( 5.1.5).
I discovered one strange thing - method GetFiles for some reasonm removes source files
I've tried to use 2 variants of the command:
$session.GetFiles(($remotePath + $i.Name ), $localPath,"false",$transferOptions).Check()
$session.GetFiles(($remotePath + $i.Name ), $localPath,$transferOptions).Check()
These commands downloads all files from a _folder_ on a FTP server.

Files were downloaded and after that the source folder become removed.

Reply with quote

Advertisement

dimic
Joined:
Posts:
4

Seems that this happens not only for folders, but also for files
In the debug log I always see something like:
<group name="get -delete -nopermissions -preservetime -transfer=&quot;binary&quot; -- &quot;/PA/dimic/temp2/1031/BM_1031_1300_tr.mp4&quot; &quot;d:\temp\mp4\*&quot;" start="2013-07-10T15:08:43.665Z">
<download>
<filename value="/PA/dimic/temp2/1031/BM_1031_1300_tr.mp4" />
<destination value="d:\temp\mp4\BM_1031_1300_tr.mp4" />
<result success="true" />
</download>
<rm>
<filename value="/PA/dimic/temp2/1031/BM_1031_1300_tr.mp4" />
<result success="true" />
</rm>
</group>

Reply with quote

dimic
Joined:
Posts:
4

Aha! Thanks Martin!
I'm new in Powershell, stupid mistake.

But I still have a question regarding skipped boolean parameter. As far as I understood from documentation, the default value for skipped parameter should be False, but the command
$session.GetFiles(($remotePath + $i.Name ), $localPath,$transferOptions).Check()
anyway removes source files from FTP

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

dimic wrote:

But I still have a question regarding skipped boolean parameter. As far as I understood from documentation, the default value for skipped parameter should be False, but the command
$session.GetFiles(($remotePath + $i.Name ), $localPath,$transferOptions).Check()
anyway removes source files from FTP
Now you are passing $transferOptions to remove parameter. As it is non-empty object, I expect again that PowerShell interprets it as True.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum