Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

ZianAtFirstWatch wrote:

Would it be possible to add your tweak from the 2021-09-13 post to the script that is included in the WinSCP setup program?

That won't work well with the default Commander interface.
ZianAtFirstWatch

Thanks for the tip. I wasn't able to reproduce the crash I described in the 2022-07-01 16:55 post.

Would it be possible to add your tweak from the 2021-09-13 post to the script that is included in the WinSCP setup program?
martin

Re: WinSCPnet.dll is missing

If you want to test the script, you need to either run it from a folder that also contains WinSCP.exe and WinSCPnet.dll, or set WINSCP_PATH environment variable to point to such folder (typically C:\Program Files (x86)\WinSCP).
ZianAtFirstWatch

WinSCPnet.dll is missing

Thanks for the tip. Based on the below output, is it possible that the PowerShell script that was installed as part of WinSCP 5.21.2 should be updated?

I re-applied your suggested tweaks after installing the update.

The computer said:
Microsoft Windows [Version 10.0.19043.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\zchoy>powershell.exe -ExecutionPolicy Bypass -File "C:\Program Files (x86)\WinSCP\Extensions\ArchiveDownload.WinSCPextension.ps1" -sessionUrl "sftp://firstwatchcommunity:2s3yyMxu5CEkkGO;fingerprint=ssh-ed25519-k6RHsnipsnipsnipo94k;x-name=abc%2520Community%2520%28Marketing%2520Site%29@nice.try:15480/" -remotePath "/www/firstwatchcommunity_871/" -localPath "C:\Users\zchoy\Downloads" -archiveName "archive" -pause -sessionLogPath "" -path7zip "C:\Program Files\7-Zip\7z.exe" -archiveType zip -archiveCommand "" public
Error: Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path 'C:\Program Files (x86)\WinSCP\Extensions\WinSCPnet.dll' because it does not exist."

Press any key to exit...
martin

To debug the problem, have WinSCP copy the extension (custom command) commandline to the clipboard:
https://winscp.net/eng/docs/custom_command#debugging
And then execute the command from cmd console. This way you will be able to see any error it might produce.
ZianAtFirstWatch

You're right. I'm using the Explorer-like view.

After making the 2 changes, I can see the new textbox in the dialog as shown in the screenshot. However, after PowerShell starts, the PowerShell window closest abruptly after a few minutes and no files are created in the destination directory (Downloads).

I've attached the command-line used to launch PowerShell. The information was recorded by Process Monitor.
martin

I assume you are using the Explorer interface of WinSCP then. With the default two-pane Commander interface, the extension downloads the file to the directory opened in the local panel. In the Explorer interface, it downloads to the last local directory used. I might improve that if there's demand, but few users actually use the Explorer interface.
And this an easy fix, just edit the extension file as follows:
– replace -localPath "!\" with -localPath "%LocalPath%"
– add this after the @option ArchiveName line:
# @option       LocalPath -run textbox "&Target path:" "!\"

Let me know if it works.
ZianAtFirstWatch

Thanks for the new build. It's almost perfect.

The PowerShell window happily announces that all the files were added, the archive was created, and then it says "Downloading..."

A few seconds later, the window closes and I'm left wondering where archive.zip went.

I checked the setting I mentioned in the original post and it's still blank. I checked my Downloads and Documents folder and couldn't see the file there. Finally, in desperation, I checked the last folder I used when synchronizing a folder with the remote SFTP server. I saw the archive.zip there.

I don't think it's reasonable to ask users to memorize (for an indefinite amount of time) the full path of the last folder they used to synchronize with WinSCP.

Is there any chance that the program will let the user tell it where to put archive.zip?
martin

I have sent you a new download link.
ZianAtFirstWatch

Thanks for the suggestion. After doing that, I can start the command.

Then, PowerShell says:
Connecting...
Error: Exception calling "Open" with "1" argument(s): "The version of C:\Program Files (x86)\WinSCP\winscp.exe (6.0.0.0) does not match version of this assembly C:\Program Files (x86)\WinSCP\WinSCPnet.dll (5.19.2.0)."

Press any key to exit...
martin

You have to place the .exe file to your WinSCP installation folder.
ZianAtFirstWatch

I can't find the "Archive and Download..." menu item in the development build (11632 2021-07-27 - Do NOT distribute).

I confirmed that the menu item is still visible when I use version 5.19.2 (build 11614).

Has its location changed?
ZianAtFirstWatch

Unable to set local path for the Archive and Download command

Steps to Reproduce:
1. Launch WinSCP from the Start menu.
2. Login to a SFTP host (we'll call it "F").
3. Right-click on a folder (e.g. public) and select File Custom Commands | Archive and Download...
4. Click OK
5. Watch a PowerShell window start up and successfully package all the files into a ZIP.

Actual Results (Final entries below; full log attached):
Archive archive.zip created.
Downloading...
Error: Exception calling "Check" with "0" argument(s): "Can't create file 'C:\Users\Zian\Documents\Personal\Webpage\archive.zip.filepart'.
System Error. Code: 3.
The system cannot find the path specified"

Press any key to exit...

Expected Result:
I would have expected WinSCP to let me specify the local path after step 3 or after step 5. I'm not surprised it can't create the file in c:\users\zian\documents\personal because there's no personal folder in the Documents folder on my computer's C drive.

https://winscp.net/eng/docs/faq_dir_default says that I can set the local path by going to Advanced Site Settings. However, that dialog says "Local directory is not used with Explorer interface."

Additional Details:
WinSCP Version: 5.19.2
Windows version: 21H1
Protocol: SFTP
GUI or automation: GUI

I've attached a ZIP file with screenshots, the session log, and the full PowerShell output.