tar从存档中的文件夹中提取所有文件

时间:2021-04-20 22:49:59

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

假设我有一个具有以下结构的tar存档:

"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?

现在我不想从文件夹test123中提取所有文件而不提取“test123”文件夹本身。命令是什么命令?

2 个解决方案

#1


1  

Try:

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

Works for me.

适合我。

#2


0  

Use the tar zxvf option, like this:

使用tar zxvf选项,如下所示:

tar -zxvf tarfolder.tar.gz test123/file1

#1


1  

Try:

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

Works for me.

适合我。

#2


0  

Use the tar zxvf option, like this:

使用tar zxvf选项,如下所示:

tar -zxvf tarfolder.tar.gz test123/file1