java 复制单个文件 服务器上

来源:百度知道 编辑:UC知道 时间:2024/08/23 01:32:31
我想在本地写一个复制程序,控制在服务器上的一个文件,从服务器上一个文件中内容,复制到服务器上另一个文件中。

public class cpFils {

public boolean push() {
boolean reValue = false;

try {
String[] toDirs = { "dir1", "dir2", "dir3" };
cpStruct tmpCps = new cpStruct();
for (String _dir : toDirs) {
tmpCps = new cpStruct();
tmpCps.setToDir(_dir);
new Thread(new ThreadCp(tmpCps)).start();
}
} catch (Exception e) {
// log
}
return reValue;
}

public static void main(String arg[]) {

new cpFils().push();
System.out.println("end");
}
}

class ThreadCp implements Runnable {
public cpStruct cps;

public ThreadCp() {
}

public ThreadCp(cpStruct _cps) {
this.cps = _cps;
}

publ