login about faq

I just want a list of the files in the tar (USTar) archive, but I've only managed to retrieve the xml file with the file if I e.g. verify or extract the archive. Can't I just read the archive? Verify and extract takes too long for what I need (a quick look).

asked Sep 14 '15 at 21:25

benneharli's gravatar image


Thanks! A TAR archive is different than a Zip archive in that there is no "central directory" structure to make it easy to quickly and easily see the contents of the archive. TAR stands for "Tape Archive", and it's quite old -- used when files were backed up to tape. (I'm old enough to remember those days..) Anyway, the format of a TAR archive goes like this: fileHeader1, fileData1, fileHeader2, fileData2, ...

Each file header provides an offset to the next file header. The only way to know what files are in the archive is to read the 1st header, skip past the data, read the next header, and so on. This involves scanning the entire archive -- the quickness depends on the characteristics of the TAR archive. For example, one might have a very large archive (perhaps more than a GB), but if there are very few files (because all the files are large), then the scan would happen very quickly because skipping over huge amounts of data is fast because a program has random-access to the data in the file (i.e. it can set the file pointer to the next header and read). However, if the TAR archive has a huge number of small files, then scanning the archive would most certainly take much more time.


answered Sep 14 '15 at 22:57

chilkat's gravatar image

chilkat ♦♦

Hmm... Didn't get the ListXml to work until now...

Works now :-)


answered Sep 14 '15 at 21:34

benneharli's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Sep 14 '15 at 21:25

Seen: 526 times

Last updated: Sep 14 '15 at 22:57

powered by OSQA