12/08/2023By using WinSCP, it is possible to download files from a server to its workstation more quickly, by first compressing them directly on the server.
This functionality is available through scripts integrated into the software.
It is particularly useful when you need to repatriate large files from a server to your local computer, such as log files.
Prerequisites/facilities
On the server side, it is necessary to have:
- An SFTP or SCP access:
- Check that the ssh service is present and started:
- If not, install it:
sudo apt update
sudo apt install openssh-server
- Once started, WinSCP will be able to connect to it in SFTP, using the SSH username/password
- "zip" utility:
If "zip" is not already present on the server, you can install it as follows: - OnRedhat :
- On Debian/Ubuntu :
On the local side, you must have WinSCP with the extension installed (it is not installed on the portable version):
- Launch WinSCP, go to the Options menu then Preferences
- On the left side, go to the Commands section
- If you see the Archive and Download custom command, your version already contains the feature. You can skip to the next chapter on how to use it.
- If you don't see the command, click the Add button, choose Add Extension:
- Enter the path of the extension, namely its page: winscp.net/eng/docs/extension_archive_and_download :
- Validate. A new line, Archive and Download, has been added. It is this new command that will be used from the WinSCP screens:
- Validate the options.
Using download with compression
- Launch WinSCP and connect to your server.
- Right-click on a server-side file that you want to download locally.
- Choose from the context menu "Custom command file" then "Archive and download".
| |
- On the "Archive and download" window that is then displayed, check "Extract after download" to automatically decompress the "archive.zip" file created.
- By validating the window, your file to download will be:
- compressed on the server in an archive.zip file
- downloaded locally with this name
- extracted to the specified location
- the archive.zip file will then be deleted.
| |
Dernière modification le 12/08/2023 - Quillevere.net