它不是可能的。
FTP协议中没有API来解压缩服务器上的文件。
虽然,除了FTP访问之外,还有一种SSH访问方式并不罕见。如果是这种情况,您可以使用SSH连接并在服务器上执行 unzip
shell命令(或类似命令)来解压缩这些文件。
请参阅。
如果您需要,您可以使用FTP协议下载解压缩的文件(虽然如果您有SSH访问权限,您也可以使用SFTP访问权限,然后使用SFTP而不是FTP)
一些(很少的)FTP服务器提供了一个API来执行任意shell(或其他)命令,使用 SITE EXEC
命令(或类似)。但这真的非常罕见。您可以像上面的SSH一样使用此API。
Can I extract the ZIP file in FTP and place this extracted file on the same location using C#?
It's not possible.
There's no API in the FTP protocol to un-ZIP a file on a server.
Though, it's not uncommon that one, in addition to an FTP access, have also an SSH access. If that's the case, you can connect with the SSH and execute the unzip
shell command (or similar) on the server to decompress the files.
See C# send a simple SSH command.
If you need, you can then download the extracted files using the FTP protocol (Though if you have the SSH access, you will also have an SFTP access. Then, use the SFTP instead of the FTP.).
Some (very few) FTP servers offer an API to execute an arbitrary shell (or other) commands using the SITE EXEC
command (or similar). But that's really very rare. You can use this API the same way as the SSH above.
这篇关于我们可以使用C#解压FTP服务器上的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!