Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now I am running an extract from a .gz file using the Windows gzip.exe.

However when I decompress the file, it kills the .gz file and leaves me with the extract file. For example if I run this on the command line:

gzip.exe -d -f foo.csv.gz

I get foo.csv out of the zip file, but lose the foo.csv.gz file. I have been searching online but couldn't find a flag that says keep the base file or anything. Is there a flag that I am missing? Or do I need to extract it and then recompress it in order to archive the file?

share|improve this question

migrated from facebook.stackoverflow.com Sep 9 '11 at 11:10

This question came from our site for professional and enthusiast programmers.

up vote 8 down vote accepted

Try:

gunzip -c foo.csv.gz > foo.csv

or (synonymously):

gzip -d -c foo.csv.gz > foo.csv
share|improve this answer
    
D'oh ... I figured it was something simple. Thank you very much :) Is there a solution that I can use *.csv.gz if there are more than one file, or do I need to expand it out and go one by one? – judda Sep 8 '11 at 17:12
    
@judda: On Windows, you'll need to use a FOR loop. – Hello71 Oct 16 '11 at 2:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .