Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

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

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
add comment

Try:

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
1  
Then you should accept the answer! ;-) –  Mithrandir Jan 23 '12 at 10:20
add comment

Normally I'd use a combination of mkdir and:

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

Your Answer

 
discard

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