A
au.danji
I am trying to run the Runtime.getRuntime().exec(shellCMD) to copy
files on a linux system.
but the getRuntime.exec() is very slow, it can only copy around 2-10
documents/second to my target directory when I have 1000 files. Can
anyone give some suggestions about my code below? thanks.
for (doc ahit : docList) {
try{
shellCMD="cp "+ srcDir + "/"+ ahit.doc_id + " " +
tarDumpDir; //copy xml to tmp folder
Process process = Runtime.getRuntime().exec
(shellCMD);
//process.waitFor();
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
}
catch (Exception e){
logError("Copy XML fail: " + e);
}
}
files on a linux system.
but the getRuntime.exec() is very slow, it can only copy around 2-10
documents/second to my target directory when I have 1000 files. Can
anyone give some suggestions about my code below? thanks.
for (doc ahit : docList) {
try{
shellCMD="cp "+ srcDir + "/"+ ahit.doc_id + " " +
tarDumpDir; //copy xml to tmp folder
Process process = Runtime.getRuntime().exec
(shellCMD);
//process.waitFor();
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
}
catch (Exception e){
logError("Copy XML fail: " + e);
}
}