untar file without subdirectories containing it [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
This question already has an answer here:
How to extract only files without creating directory paths from tar.gz file?
2 answers
I have a tar archive foo.tar.gz, inside of which a directory containing another directory contains a file: folder_1/folder_2/file.txt.
I want to untar file.txt without extracting folder_1/folder_2/.
Using
tar -xvf foo.tar.gz folder_1/folder_2/file.txt
I get file.txt inside the subdirectories that contained it inside the tar archive (folder_1/folder_2/file.txt).
Is there a way of getting only file.txt and nothing else in a single command, avoiding extracting everything?
directory tar
marked as duplicate by ñÃÂsýù÷, Jeff Schaller, G-Man, Isaac, Archemar Feb 9 at 6:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
This question already has an answer here:
How to extract only files without creating directory paths from tar.gz file?
2 answers
I have a tar archive foo.tar.gz, inside of which a directory containing another directory contains a file: folder_1/folder_2/file.txt.
I want to untar file.txt without extracting folder_1/folder_2/.
Using
tar -xvf foo.tar.gz folder_1/folder_2/file.txt
I get file.txt inside the subdirectories that contained it inside the tar archive (folder_1/folder_2/file.txt).
Is there a way of getting only file.txt and nothing else in a single command, avoiding extracting everything?
directory tar
marked as duplicate by ñÃÂsýù÷, Jeff Schaller, G-Man, Isaac, Archemar Feb 9 at 6:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
How to extract only files without creating directory paths from tar.gz file?
2 answers
I have a tar archive foo.tar.gz, inside of which a directory containing another directory contains a file: folder_1/folder_2/file.txt.
I want to untar file.txt without extracting folder_1/folder_2/.
Using
tar -xvf foo.tar.gz folder_1/folder_2/file.txt
I get file.txt inside the subdirectories that contained it inside the tar archive (folder_1/folder_2/file.txt).
Is there a way of getting only file.txt and nothing else in a single command, avoiding extracting everything?
directory tar
This question already has an answer here:
How to extract only files without creating directory paths from tar.gz file?
2 answers
I have a tar archive foo.tar.gz, inside of which a directory containing another directory contains a file: folder_1/folder_2/file.txt.
I want to untar file.txt without extracting folder_1/folder_2/.
Using
tar -xvf foo.tar.gz folder_1/folder_2/file.txt
I get file.txt inside the subdirectories that contained it inside the tar archive (folder_1/folder_2/file.txt).
Is there a way of getting only file.txt and nothing else in a single command, avoiding extracting everything?
This question already has an answer here:
How to extract only files without creating directory paths from tar.gz file?
2 answers
directory tar
edited Feb 8 at 14:01
Jeff Schaller
31.3k846105
31.3k846105
asked Feb 8 at 13:21
tli
234
234
marked as duplicate by ñÃÂsýù÷, Jeff Schaller, G-Man, Isaac, Archemar Feb 9 at 6:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by ñÃÂsýù÷, Jeff Schaller, G-Man, Isaac, Archemar Feb 9 at 6:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You can extract the file to standard output and redirect that:
tar -xvf foo.tar.gz -O folder_1/folder_2/file.txt > file.txt
(Note that the option is a capital âÂÂOâÂÂ, not the digit âÂÂ0âÂÂ.)
I am getting this printed out, and myfile.txt
gets extracted without any content:tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using-O
(capital letter O), or-0
(number 0)? The capital letter O option is a GNU tar extension to extract tostdout
.
â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You can extract the file to standard output and redirect that:
tar -xvf foo.tar.gz -O folder_1/folder_2/file.txt > file.txt
(Note that the option is a capital âÂÂOâÂÂ, not the digit âÂÂ0âÂÂ.)
I am getting this printed out, and myfile.txt
gets extracted without any content:tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using-O
(capital letter O), or-0
(number 0)? The capital letter O option is a GNU tar extension to extract tostdout
.
â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
add a comment |Â
up vote
2
down vote
accepted
You can extract the file to standard output and redirect that:
tar -xvf foo.tar.gz -O folder_1/folder_2/file.txt > file.txt
(Note that the option is a capital âÂÂOâÂÂ, not the digit âÂÂ0âÂÂ.)
I am getting this printed out, and myfile.txt
gets extracted without any content:tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using-O
(capital letter O), or-0
(number 0)? The capital letter O option is a GNU tar extension to extract tostdout
.
â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You can extract the file to standard output and redirect that:
tar -xvf foo.tar.gz -O folder_1/folder_2/file.txt > file.txt
(Note that the option is a capital âÂÂOâÂÂ, not the digit âÂÂ0âÂÂ.)
You can extract the file to standard output and redirect that:
tar -xvf foo.tar.gz -O folder_1/folder_2/file.txt > file.txt
(Note that the option is a capital âÂÂOâÂÂ, not the digit âÂÂ0âÂÂ.)
edited Feb 8 at 14:12
answered Feb 8 at 13:51
Stephen Kitt
142k22308369
142k22308369
I am getting this printed out, and myfile.txt
gets extracted without any content:tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using-O
(capital letter O), or-0
(number 0)? The capital letter O option is a GNU tar extension to extract tostdout
.
â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
add a comment |Â
I am getting this printed out, and myfile.txt
gets extracted without any content:tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using-O
(capital letter O), or-0
(number 0)? The capital letter O option is a GNU tar extension to extract tostdout
.
â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
I am getting this printed out, and my
file.txt
gets extracted without any content: tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
I am getting this printed out, and my
file.txt
gets extracted without any content: tar: Options '-[0-7][lmh]' not supported by *this* tar Try 'tar --help' or 'tar --usage' for more information.
â tli
Feb 8 at 14:00
@tli Are you using
-O
(capital letter O), or -0
(number 0)? The capital letter O option is a GNU tar extension to extract to stdout
.â Andrew Henle
Feb 8 at 14:06
@tli Are you using
-O
(capital letter O), or -0
(number 0)? The capital letter O option is a GNU tar extension to extract to stdout
.â Andrew Henle
Feb 8 at 14:06
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
@AndrewHenle my bad, thanks for pointing that out, now it works!
â tli
Feb 8 at 14:12
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
The option is also supported on other platforms, e.g. FreeBSD.
â Stephen Kitt
Feb 8 at 14:13
add a comment |Â