简体   繁体   English

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

[英]Should retrieveFile of commons FTPClient remove file from remote server

We are using Commons FTPClient to retrieve files from an ftp server. 我们使用Commons FTPClient从ftp服务器检索文件。 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 . 当我们运行此代码时,文件将从FTP服务器移动而不是复制 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) (我们无权写入FTP服务器,因此我们无法将文件写回服务器)

Any help appreciated, 任何帮助,赞赏,

Thanks 谢谢

It is very strange behavior. 这是非常奇怪的行为。 I have just examined the code of FTPClient and did not see something that may remove the remote file. 我刚刚检查了FTPClient的代码,但没有看到可能删除远程文件的内容。 I believe that this is a configuration of your FTP server. 我相信这是您的FTP服务器的配置。

To check it I'd recommend you to try other FTP client. 要检查它,我建议你尝试其他FTP客户端。 For example unix command line utility ftp or fget or regular web browser. 例如,unix命令行实用程序ftpfget或常规Web浏览器。

I wish you good luck. 祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM