Take the 2-minute tour ×

How can I unzip a file from another folder?

gunzip -d /home/tomcat_dev/HN/radd/input.txt.gz 

unzips that file to the same folder. But if I want to bring it to my folder? When I do this:

gunzip -d /home/tomcat_dev/HN/radd/o.txt.gz /home/tomcat_dev/ 

it gives me a: gunzip: /home/tomcat_dev/ is a directory -- ignored

share|improve this question

migrated from stackoverflow.com Jan 25 '12 at 13:28

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

That's been already answered here. –  jcollado Jan 23 '12 at 10:15

3 Answers 3

up vote 2 down vote accepted

It is as simple as below:

gunzip -c filepath.gz > anotherDirectoryPath

More on gunzip, also refer to the man page.

share|improve this answer


gunzip -c -d /home/tomcat_dev/HN/radd/o.txt.gz > /home/tomcat_dev/o.txt 
share|improve this answer
It works! 10x a lot –  radashk RADU Jan 23 '12 at 10:18
Then you should accept the answer! ;-) –  Mithrandir Jan 23 '12 at 10:20

Normally I'd use a combination of mkdir and:

gzcat /path/to/somefile.gz >/some/new/path/output
share|improve this answer

Your Answer

