Comments on: How to Extract Tar Files to Specific or Different Directory in Linux https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Sat, 16 Nov 2024 19:23:24 +0000 hourly 1 By: sathishkumar p https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/comment-page-1/#comment-2242843 Sat, 16 Nov 2024 19:23:24 +0000 http://www.tecmint.com/?p=18010#comment-2242843 After going through the article, I have found the solution for extracting XML files to a common folder in Windows using a one-liner for files with names like name.subname.tar.gz. This works with paths containing .tar.gz files without a dot (.) in the path:

mkdir commonxml && for /f "tokens=1,2,3,4 delims=." %i in ('dir /b /s *.tar.gz') do @tar -zvf "%i.%j.%k.%l" -t "*%~ni.xml" && @tar --strip-components 1 -C ./commonxml/ -zxvf "%i.%j.%k.%l" "*/%~ni.xml" || @echo "Error occurred: file not found, skipping..."

]]>
By: Pascal https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/comment-page-1/#comment-1476847 Fri, 16 Apr 2021 05:12:33 +0000 http://www.tecmint.com/?p=18010#comment-1476847 Great article.

Just to note that “Example 4: Extract Only Specific or Selected Files from Tar Archive” is the wrong syntax.

The order of the arguments has to be changed. The single files or directories to be extracted need to be last:

It shall read

# tar -xvf etc.tar  -C /backup/tar_extracts/    etc/issue etc/fuse.conf etc/mysql/

reference: https://stackoverflow.com/a/9249779

]]>
By: Aaron Kili https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/comment-page-1/#comment-1100254 Sun, 10 Feb 2019 08:59:38 +0000 http://www.tecmint.com/?p=18010#comment-1100254 In reply to SHIVANI UMEACADEMY. COM.

@SHIVANI

I would like you to know that we are pleased to have read your beautiful and kind note of appreciation and encouragement.

]]>
By: SHIVANI UMEACADEMY. COM https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/comment-page-1/#comment-1099715 Thu, 07 Feb 2019 10:22:48 +0000 http://www.tecmint.com/?p=18010#comment-1099715 Your blog is very good, your blog has great information, your content is also very good, your blog has got a lot of help.

]]>
By: Eric https://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/comment-page-1/#comment-929980 Wed, 01 Nov 2017 15:04:01 +0000 http://www.tecmint.com/?p=18010#comment-929980 In reply to Ravi Saive.

Oh… if I change the order it works. If I move the “–directory ” earlier in the args, it works.

]]>