Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

sendo wrote:

too bad, batch continue option seems to be unsupported, so i will call getfiles for each file with something like that

That's the correct way.
sendo

too bad, batch continue option seems to be unsupported, so i will call getfiles for each file with something like that :


$excludeDir='|*/'
$directory = $session.ListDirectory("$remotePath")
foreach ($file in $directory.Files | where {-not $_.IsDirectory})
{
foreach ($f in $file)
{
$transferOptions.FileMask = $f.Name + $excludeDir
$transfer = $Session.GetFiles($remotePath, $localPath, $false, $transferOptions)
if ($transfer.Transfers.Error) {Write-Host ("{0} : {1}" -f $transfer.Transfers.FileName, $transfer.Transfers.Error) -ForegroundColor Red
}
}
sendo

Ignore errors when downloading

Hi guys,
Sorry if i missed something but does anyone know how to ignore errors when downloading ?
I have to download multiple files but the operation failed beacause i don't have permissions to access some files.
So i'm looking for a "continue with next" option
I tried to set ContinueOnError or PreserveReadOnly
I also tried :
try

{
 $transferResult = $Session.GetFiles($remotePath, $localPath, $false, $transferOptions)
}
catch {}


but the exception still raise and seem to be uncatchable.
Any ideas ?
(I'm using the last build with powershell)

Thanks