将文件从一台服务器复制到另一台服 [英] Copy file from one server to another

查看:382
本文介绍了将文件从一台服务器复制到另一台服的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将文本文件从一个服务器复制到另一个服务器(两个服务器都是Linux)。
我如何用Java做到这一点?

I need to copy a text file from one server to another (both the servers are Linux). How do I do that in Java?

推荐答案

如果你能够使用 apache commons-io FileUtils 类有方便的方法来复制文件:

Easist if you're able to use apache commons-io: the FileUtils class has convenient methods to copy files:

FileUtils.copyFileToDirectory(srcFile, targetDirectory);

(正如你所说的文字文件我认为,你的应用程序可以访问两个文件系统)

(as you talked about text files I assume, your application has access to both file systems)

这篇关于将文件从一台服务器复制到另一台服的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆