应该检索公共FTPClient的文件从远程服务器删除文件

发布于 2024-10-08 07:29:49 字数 482 浏览 0 评论 0原文

我们使用 Commons FTPClient 从 ftp 服务器检索文件。我们的代码类似于:

FTPClient ftpClient= new FTPClient();  
ftpClient.connect(server);  

ftpClient.login(username, password);

FileOutputStream out = new FileOutputStream(localFile);  

ftpClient.retrieveFile(remoteFile, out)

当我们运行此代码时,文件将从 FTP 服务器移动,而不是复制。只是想知道这是预期的行为吗?

如果这是预期行为,从服务器检索文件副本但在服务器上保留文件副本的最佳方法是什么? (我们无权写入 FTP 服务器,因此我们无法将文件写回服务器)

感谢您的帮助,

谢谢

We are using Commons FTPClient to retrieve files from an ftp server. Our code is similar to:

FTPClient ftpClient= new FTPClient();  
ftpClient.connect(server);  

ftpClient.login(username, password);

FileOutputStream out = new FileOutputStream(localFile);  

ftpClient.retrieveFile(remoteFile, out)

When we run this code the file is moved from the FTP Server instead of copied. Just wondering is this expected behavior?

If this is expected behavior what is the best approach to retrieve a copy of the file from the server but leave a copy of the file on the server? (We do not have access to write to the FTP Server so we cannot write the file back to the server)

Any help appreciated,

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋意浓 2024-10-15 07:29:49

这是非常奇怪的行为。我刚刚检查了 FTPClient 的代码,没有看到可能删除远程文件的内容。我相信这是您的 FTP 服务器的配置。

要检查它,我建议您尝试其他 FTP 客户端。例如,unix 命令行实用程序 ftpfget 或常规 Web 浏览器。

祝你好运。

It is very strange behavior. I have just examined the code of FTPClient and did not see something that may remove the remote file. I believe that this is a configuration of your FTP server.

To check it I'd recommend you to try other FTP client. For example unix command line utility ftp or fget or regular web browser.

I wish you good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文