我可以在 FTP 中提取 ZIP 文件并使用 C# 将此提取的文件放在同一位置吗?
Can I extract the ZIP file in FTP and place this extracted file on the same location using C#?
不可能.
FTP 协议中没有用于解压缩服务器上文件的 API.
There's no API in the FTP protocol to un-ZIP a file on a server.
但是,除了 FTP 访问之外,还具有 SSH 访问的情况并不少见.如果是这种情况,您可以通过 SSH 连接并在服务器上执行 unzip shell 命令(或类似命令)来解压文件.
请参阅 C# 发送简单的 SSH 命令.
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.
如果需要,您可以使用 FTP 协议下载提取的文件(尽管如果您有 SSH 访问权限,您也将拥有 SFTP 访问权限.然后,使用 SFTP 而不是 FTP.).
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.).
一些(极少数)FTP 服务器提供 API 以使用 SITE EXEC 命令(或类似命令)执行任意 shell(或其他)命令.但这真的非常罕见.你可以像上面的 SSH 一样使用这个 API.
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.
如果您想在本地下载和解压缩文件,您可以在内存中进行,而无需将 ZIP 文件存储到物理(临时)文件中.有关示例,请参阅如何将存储在 FTP 服务器上的 ZIP 文件中的数据导入 C# 中的数据库.
If you want to download and unzip the file locally, you can do it in-memory, without storing the ZIP file to physical (temporary) file. For an example, see How to import data from a ZIP file stored on FTP server to database in C#.
这篇关于我们可以使用 C# 在 FTP 服务器中解压缩文件吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
ASP.NET Core 使用 Azure Active Directory 进行身份验证并ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 进行身
ASP.NET Core 2.0 Web API Azure Ad v2 令牌授权不起作用ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授权不起作用)
ASP Core Azure Active Directory 登录使用角色ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登录使用角色)
如何获取守护进程或服务器到 C# ASP.NET Web API 的How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何获取守护进程或服务器到 C# ASP.N
.Net Core 2.0 - 获取 AAD 访问令牌以与 Microsoft Graph.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 获取 AAD 访问令牌以与 Microsoft Graph 一起使用)
异步调用时 Azure KeyVault Active Directory AcquireTokenAAzure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(异步调用时 Azure KeyVault Active Directory AcquireTokenAsync 超