Howdy,
I have a puzzling issue on my hands. I am attempting to run a tar command by using a ProcessBuilder basically as follows.
String cmd = "tar cvf my.tar --exclude='*t' --exclude='*s' dird";
String[] arr = cmd.split(" ");
ProcessBuilder builder = new ProcessBuilder(arr);
System.out.println("Running "+cmd);
Process p = builder.start();
InputStream stream = p.getInputStream();
byte[] b = new byte[1024];
while(stream.read(b) != -1){
System.out.println(new String(b));
}
p.waitFor();
System.out.println("done");
while(stream.read(b) != -1){
System.out.println(new String(b));
}
It appears that the exclude flags are getting ignored. But If I run ls -al as the command it runs as expected. Also running the following find command appears to ignore the -regex flag. find . -regex ".*txt".
Any ideas?
Thank you
J