0

I have a ZIP file in SFTP (WinSCP) location.

Is it possible to extract the ZIP file in same SFTP location using ACP.NET Core? Any help would be much appreciated

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

3

You cannot unzip files on remote server using SFTP protocol. That's not possible. No matter what language or libraries do you use.

You cannot use client-side libraries to unzip a non-local file either. You would have to download the archive (to a temporary local file or at least to a memory), extract it and upload the extracted files back. That's probably not what you want.

Best you can do (if you have a shell access) is to execute (using SSH) any available command on the remote server to do the extraction in-place.
For an example how to execute a shell command over SSH using SSH.NET library in C#, see:
C# send a simple SSH command.

A related question about FTP: Can we unzip file in FTP server using C#
(with basically the same answer – though with SFTP, it is more likely you have a shell access, than with FTP)

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992