bash - tar command execution from java does not work as expected -
tar command execution java not work expected. below lines of code same. tar file getting created, empty, though there matching files in directory tar. not sure issue. inputs helpful.
note: same command when execute on terminal works fine, tar ball having intended files.
string cmd = "tar -cvzf /tmp/logs.tar.gz /home/test/log/status.*" try { process p1 = runtime.getruntime().exec(cmd); p1.waitfor(); } catch (ioexception e) { e.printstacktrace(); }
obviously expansion status.*
not work. try without it. alternative resolve input files/directories within java code. use java.nio
this.
as gyro gearless mentions in comments possible wrap tar command in script , execute java code.
Comments
Post a Comment