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?

link|improve this question
feedback

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

This question came from our site for facebook developers.

1 Answer

up vote 5 down vote accepted

Try:

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

or (synonymously):

gzip -d -c foo.csv.gz > foo.csv
link|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
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.