final String unpackScriptName = "unpack.bat";
for (String host : hosts) {
String remotePassword = getPassword(host);
WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, remoteInstallDirString);
remoteInstallDir.mkdirs(getForce());
WindowsRemoteFile remoteZip = new WindowsRemoteFile(remoteInstallDir, zipFileName);
WindowsRemoteFile unpackScript = new WindowsRemoteFile(remoteInstallDir, unpackScriptName);
//createUnpackScript
System.out.printf("Copying %d bytes", zipFile.length());
remoteZip.copyFrom(zipFile, new RemoteFileCopyProgress() {
@Override
public void callback(long numcopied, long numtotal) {
//final int percent = (int)((double)numcopied / (double)numtotal * 100.0);
System.out.print(".");
}
@Override
public int getChunkSize() {
return 1048576;
}
});
System.out.println("");
String fullZipFileName = remoteInstallDirString + "\\" + zipFileName;
String fullUnpackScriptPath = remoteInstallDirString + "\\" + unpackScriptName;
unpackScript.copyFrom(makeScriptString(remoteInstallDirString, zipFileName));
logger.fine("WROTE FILE TO REMOTE SYSTEM: " + fullZipFileName + " and " + fullUnpackScriptPath);
unpackOnHosts(host, remotePassword, fullUnpackScriptPath.replace('/', '\\'));
}
}