【问题标题】:Should retrieveFile of commons FTPClient remove file from remote server应该retrieveFile of commons FTPClient 从远程服务器中删除文件
【发布时间】:2010-12-16 17:27:48
【问题描述】:

我们正在使用 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 服务器,因此我们无法将文件写回服务器)

任何帮助表示赞赏,

谢谢

【问题讨论】:

    标签: java ftp apache-commons-net


    【解决方案1】:

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

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

    祝你好运。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-29
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多