Bent
Bent

Reputation: 1385

tar extract all files from folder inside archive

Let's say I have a tar archive with the following structure:

"NAME/FOLDER/FILES"

e.g.

tarfolder.tar.gz/test123/[file1,file2,filex]

Now I wan't to extract all files from the folder test123 without extracting the "test123" folder itself. What's the command to do so?

Upvotes: 2

Views: 2140

Answers (2)

Maxim_united
Maxim_united

Reputation: 2003

Try:

tar -zxfv tarfolder.tar.gz test123/ --strip-components=1

Works for me.

Upvotes: 3

etr
etr

Reputation: 1262

Use the tar zxvf option, like this:

tar -zxvf tarfolder.tar.gz test123/file1

Upvotes: 0

Related Questions