LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Extract from `tar` archive as ordered in --files-from (http://www.linuxquestions.org/questions/linux-newbie-8/extract-from-%60tar%60-archive-as-ordered-in-files-from-926688/)

zx_ 01-31-2012 04:56 AM

Extract from `tar` archive as ordered in --files-from
 
Following command:

Code:

tar -xzf archive.tar.gz -T 'mylist.txt'
does not extract files from "archive.tar.gz" as ordered in 'mylist.txt', but as in order they are compressed.

How can I tell `tar` to extract files as ordered in 'mylist.txt'

abohmeed 01-31-2012 06:26 AM

What do you mean by "order" ?
From tar man page:
-T, --files-from F: get names to extract or create from file F
basically, it extracts only files whose names are found in the specified file.

zx_ 01-31-2012 08:18 AM

I mean files in archive are compressed like:

...
3.txt
1.txt
2.txt


and I have file list (mylist.txt):

1.txt
2.txt
3.txt
...

And want to extract them in that order, not in order as they are compressed

I (noob) was surprised that files aren't extracted in order as they are read from pointed filelist (mylist.txt)

MTK358 01-31-2012 10:15 AM

Why does the order matter, and how can you even tell what order they were extracted in?

zx_ 01-31-2012 08:44 PM

If it doesn't matter I wouldn't have asked, but instead answering on more questions while I expected answer to what it seems to me clear question, I'll just thank you for your time.

Cheers

rknichols 02-01-2012 02:28 PM

A tar archive is a linear stream with no overall index. The only way to locate a file is to read the archive from the beginning. It was originally written to work with tape drives (the name comes from "Tape ARchiver"), where seeks are expensive, and is also frequently used in pipelines, where seeks are impossible. It will always list or extract files in the order they appear in the archive.

zx_ 02-04-2012 09:08 AM

Thanks. Your reply cleared my question


All times are GMT -5. The time now is 12:32 PM.