Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

add comment

1 Answer

up vote 6 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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