8

Linux copy files from Java program

view full story
linux-howto

http://stackoverflow.com – I have written a small java code with getRuntime() API to copy files from One directory to another, it it failing, I am not able to understand why? When I run the command from shell it runs fine, can anyone, please let me know the mistake I am doing private static void copyFilesLinux(String strSource, String strDestination) { String s; Process p; try { // cp -R "/tmp/S1/"* "/tmp/D1/" p = Runtime.getRuntime().exec( "cp -R '" + strSource + "/'* '" + strDestination + "/'"); System.out.println("cp -R \"" + strSource + "/\"* \"" + strDestin (HowTos)