Example powershell script from .NET assembly does not work

Advertisement

behemoth
Guest

Example powershell script from .NET assembly does not work

Hi,

I've been trying to get the "Deleting remote files after successful remote to local synchronization" script[*] from the examples to work, but without luck. The script runs for 2 seconds and then just ends. No error message. The files on the remote FTP server are neither downloaded nor removed.

I've only changed a few parameters: localpath, remotepath, hostname, username and password. I also commented out SshHostKeyFingerprint.

I added a few Write-Host debug messages to the script in order to see how far it goes, and it seems that it never enters the "foreach ($download in $synchronizationResult.Downloads)" loop.

Any hints?

[*] https://winscp.net/eng/docs/library_example_delete_after_successful_download

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Example powershell script from .NET assembly does not work

What errors does it display?
Though if you have "commented out SshHostKeyFingerprint", it most likely fails because of that.

Reply with quote

behemoth
Guest

No errors. It just runs for a few seconds and then ends.

Is the SshHostKeyFingerprint option mandatory?

Adding a debug message before "foreach ($download in $synchronizationResult.Downloads)" prints the message, but adding the debug message after this line does not print any message. If that is of any help.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

. 2019-10-11 11:34:18.012 Collecting synchronization list for local directory 'C:\bin\FetchFTP\import\inexchange\.config' and remote directory '/frominex/.config', mode = Local, params = 0x2 (NoConfirmation), file mask = ''
. 2019-10-11 11:34:18.012 Local file 'C:\bin\FetchFTP\import\inexchange\.config\.' [2019-10-11T09:32:04.169Z] [0] excluded from synchronization
. 2019-10-11 11:34:18.012 Local file 'C:\bin\FetchFTP\import\inexchange\.config\..' [2019-10-11T09:32:04.169Z] [0] excluded from synchronization
. 2019-10-11 11:34:18.012 Retrieving directory listing...
> 2019-10-11 11:34:18.012 CWD /frominex/.config
< 2019-10-11 11:34:18.027 550 Failed to change directory.
. 2019-10-11 11:34:18.059 Could not retrieve directory listing
. 2019-10-11 11:34:18.059 Asking user:
. 2019-10-11 11:34:18.059 Error listing directory '/frominex/.config'. ("Could not retrieve directory listing","Failed to change directory.")
< 2019-10-11 11:34:18.059 Script: Error listing directory '/frominex/.config'.
< 2019-10-11 11:34:18.059 Script: Could not retrieve directory listing

< 2019-10-11 11:34:18.059 Failed to change directory.
. 2019-10-11 11:34:18.059 Script: Failed
> 2019-10-11 11:34:18.148 Script: exit
Maybe your server does not allow an access to hidden folders.
Try to exclude them from the synchronization using file mask | .*/
https://winscp.net/eng/docs/file_mask

Reply with quote

Advertisement

You can post new topics in this forum