I need to execute this tar command 

*tar xzf dir1/dir2/somefile.tgz --directory=dir1/dir2/*

from within a Go program.  I've verified that it works from the command 
line.  I've tried using 


*argStr := "xzf dir1/dir2/somefile.tgz --directory=dir1/dir2/"output, err 
:= exec.Command("tar", argStr).Output()*

but it returns an error code of 2 with no other output indicating what is 
wrong.

Using exec.Command(name, arg) is always a guessing game as to what the 
command name should be and what the argument should be.  How do I execute 
this tar command from within Go?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4c4345b7-2155-4bd9-ba61-7a76b5256d2fn%40googlegroups.com.

Reply via email to