Topic "PowerShell/.NET Assembly Error - Recursive calls not allowed"

Author Message
ta0147896325
[View user's profile]

Joined: 2012-05-14
Posts: 3
I receive a "Recursive calls not allowed" error connecting to a Cygwin/OpenSSH system via PowerShell/.NET assembly and issuing a Session.FileExists.

Any recommendation?
test3.zip (4.9 KB) [Download]

Description: (none)

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Thanks for your post.

This bug has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=852

I have documented workaround here:
http://winscp.net/eng/docs/library_session_fileexists
_________________
Martin Prikryl
ta0147896325
[View user's profile]

Joined: 2012-05-14
Posts: 3
Thank you for the fix. It works as expected.

Implemented in PowerShell as function at top of script:

function FileExistsFix
{
[WinSCP.Session]$pSession = $args[0]
[string]$pPath = $args[1]
try
{
$pSession.GetFileInfo($pPath)
return $TRUE
}
catch [$pSession.SessionRemoteException]
{
return $FALSE
}
}

And called within main script body as:

if (FileExistsFix $session $remotePath) {
Write-Host "Remote file exists."
}
else
{
Write-Host "Remote file does not exist."
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
I have sent you an email with a development version of WinSCP to address you have used to register on this forum.
_________________
Martin Prikryl
ta0147896325
[View user's profile]

Joined: 2012-05-14
Posts: 3
The fix within the development version works without error.

I am able to use the following and works in both cases:

if($session.FileExists($remotePath)) {
{
Write-Host "Remote file exists."
}
else
{
Write-Host "Remote file does not exist."
}

Thank you for all your work!
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