how do I gunzip to a destination directory other than the current one?

this did not work:

gunzip *.gz /putthemhere/

link|improve this question

61% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Ask gunzip to output to standard output and redirect to a file in that directory:

gunzip -c file.gz > /THERE/file

zcat is a shortcut for gunzip -c.

If you want to gunzip multiple files iterate over all files:

for f in *.gz; do
  STEM=$(basename "${f}" .pdf)
  gunzip -c "${f}" > /THERE/"${STEM}"
done

(here basename is used to get the part of the filename without the extension)

link|improve this answer
feedback

You can try with > to redirect the result to the place you want.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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