1. Requirements: Need to copy from A machine directory to B machine, and then from B machine copy directory to C machine.
2. Implementation: Run a Java program on the B-Machine and invoke the Linux SCP command to implement it.
3. Question:
Copy directory from a machine to B machine success, but from B machine copy directory to C machine failed, almost the same format command, but the command can be executed directly in Linux, with Runetime.exec call is an error.
Such as:
//This command can be successfully executed .
Runtime.exec ("Scp-r root@192.168.1.11:/ps_test/indexes/*/ps_temp/indexes/");
//The command failed to execute
Runtime.exec ("Scp-r/ps_temp/indexes/* root@192.168.1.13:/ps_test/indexes/");
4. Solution:
//Change the second command to:
Runtime.exec ("Scp-r/ps_temp/indexes root@192.168.1.13:/ps_test/indexes/");
That is, the "/*" can be removed