Warm tip: This article is reproduced from serverfault.com, please click

untar all .gz in directories and subdirectories

发布于 2014-07-30 16:56:55

For starters I have checked most of the solutions available no

How to untar all .tar.gz with shell-script?

Unzipping multiple zip files in a directory?

I have a directory that has subdirectories with .gz files in them, and would like to extract all into either one folder or just keep them in their folders. Thank you in advance

Questioner
user3862515
Viewed
0
Elliott Frisch 2014-07-31 02:15:04

If I understand your question, you could use something like

DEST=<Destination Folder>
SRC=<Src Folder>
find $SRC -name "*.tar.gz" -or -name "*.tgz" -exec tar xzvvf -C $DEST {} \;