unpack gzipped tar archive

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I get a gzipped tar archive e-mailed to me every day. Thanks to help from
this newsgroup I have a daily c# program that scans my outlook mail, finds
the archive and saves it to a file.

Now I'd like to unpack it, à là (cd targetdir; gunzip file|tar xvf -)
How do I do this from the same c# program?

Thanks for ideas & insight,
Eric
 
Hi Jon,
Wow that was quick (10 min from post to reply)

I saw the SharpZipLib reference (in the intervening 10min) while reading the
FAQ you mentioned to someone else. I didn't realize it was free so I didn't
look at it.

But... isn't there a way to just say gzip|tar? For example, I also noticed
Process.Start which must be .net's way of saying system(...).

Thanks,
Eric
 
Wow, Jon, that was quick... 10min from post to reply!

I saw SharpZipLib in the FAQ you mentioned in another post. I didn't realize
it was free so I didn't look further.

But... I already have gnu tools so it would be really easy to just use the
unix idiom below. Can I do it with .net? In the same FAQ Process.Start is
listed... that the way to do it?

Thanks,
Eric
 
Eric Nelson said:
Wow that was quick (10 min from post to reply)

I saw the SharpZipLib reference (in the intervening 10min) while reading the
FAQ you mentioned to someone else. I didn't realize it was free so I didn't
look at it.

But... isn't there a way to just say gzip|tar? For example, I also noticed
Process.Start which must be .net's way of saying system(...).

There are some differences between system() and Process.Start, I
believe, in terms of shell functions and paths, but I haven't looked in
detail.

You'd have to build the functionality you want from SharpZipLib rather
than it coming prepackaged, I think, but it shouldn't be too hard to
just extract all the files, creating any appropriate directories on the
way.

You could certainly run gunzip and tar, although you couldn't pipe the
result from one to the other unless you started a shell to do it. You
could gunzip from .tgz to .tar and then call tar afterwards though.
 
Back
Top