I need to copy files of specific pattern from one director to another
File Pattern: "nm.cdr.*(asterisk)-2014-08-16-14*(asterisk).gz"
Command: "cp " + inputPath + filesPattern + " " + destPath;
If i use specific file instead of using * than it works fine(for single file) but with pattern using * it doesn't work.
Edit 1: I tried following code:
public void runtimeExec(String cmd)
{
StringBuffer output = new StringBuffer();
Process p;
try
{
p = Runtime.getRuntime().exec(cmd);
p.waitFor();
BufferedReader reader =
new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
}
catch (IOException | InterruptedException e)
{
LogProperties.log.error(e);
}
}