Topic "Question about Walking the directory tree instead of $Session.Getfiles()"

Author Message
Alcasczar
[View user's profile]

Joined: 2016-07-30
Posts: 7
Location: NY
https://winscp.net/eng/docs/library_example_recursive_download_custom_error_handling

Question, does this process remove the file(s) it downloads on the remote side AND the directories? or should it only be the files? Using Powershell and Winscp 5.9 I noticed the $Session.Getfiles() method seems to attempt to delete the directory when you have the remove parameter set to $true.

Does this Method support using Transfer Options ie In the example I didn't see them being used so I'm curious.

Code:
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "*.pdf,*.txt|*.tmp,*.exe"
$transferOptions.TransferMode = [Winscp.TransferMode]::Binary
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Alcasczar wrote:
Question, does this process remove the file(s) it downloads on the remote side AND the directories?

If you set the remove parameter to true, it will remove whatever you have downloaded. So if you download file, it will remove the file, if you download a directory, it will remove the directory. The example you refer to downloads files only. The directories are created locally by the script/code, they are not "downloaded" by the GetFiles. So even if you add the remove parameter, the directories won't be deleted.

Quote:
Does this Method support using Transfer Options ie In the example I didn't see them being used so I'm curious.

The options (TransferOptions type) is an optional parameter (the 4th, after the remove).
It's not used in the example, so the default transfer options are used.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License