我们正在使用 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 服务器,因此我们无法将文件写回服务器)
任何帮助表示赞赏,
谢谢