Problem with copy files using cmd in Java

I'm trying to copy a bunch of files with a specific extension from one folder to another using the copy command, heres wat im doing,

 String[] command = new String[3];
 command[0] = "cmd";
 command[1] = "/c";
 command[2] = "copy C:\\output\\html\\*.txt C:\\output\\";

 ProcessBuilder copyFiles = new ProcessBuilder(command);
 p = copyFiles.start();
 p.waitFor();

the thing is, this code works fine for files less than some 5 or so, but just stops responding wen the number of files are more (even for 15 files) !! and the files are not copied either!! Не знаю, в чем проблема, буду рад, если кто-то поможет! :)

5
задан Joey 2 May 2011 в 18:08
поделиться