Skip to content

Instantly share code, notes, and snippets.

@wataru420
Created January 30, 2012 06:10
Show Gist options
  • Save wataru420/1702859 to your computer and use it in GitHub Desktop.
Save wataru420/1702859 to your computer and use it in GitHub Desktop.
ProcessBuilderでワイルドカードを使いたいとき
public void cp(String source, String dist) throws Exception {
String command = "cp " + source + " " + dist;
String[] cmd = new String[] { "/bin/sh", "-c", command };
this.exec(cmd);
ProcessBuilder pb = new ProcessBuilder(cmd);
Process p = pb.start();
int val = p.waitFor();
if (val != 0) {
this.logErrorCommand(cmd);
throw new Exception("Exception during RSync; return code = " + val);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment