Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to untar and only extract those files that are above a certain date including directory structure??

I restored a backup on a play server but it was a few days old. However I have a tar archive of the entire structure that is more up to date and healthy so now I want to extract all files (including directory structure) based on a date filter on the files if possible?

share|improve this question

If you can't figure out how to do something with tar, you can try pax, which you can think of as a modern version of tar (and cpio). It can do most of what tar can do (at least as long as tape drives aren't involved), and its syntax doesn't suffer from decades of cruft.

In particular, pax offers a -T [from_date][,to_date] option, so you can do something like pax <backup.tar -r -pe -T 1006150000 to extract only files dated June 15 or newer. Alternatively, pax <backup.tar -r -pe -u will refrain from extracting files for which the version in the archive is older than the version in the extraction directory.

Pax is often not installed by default, but all linux distributions should have it. It's specified by Single Unix, so it should be available on all unix systems and unixy environments such as Cygwin.

Finally, if you want really fine control, you can extract the files another location and use rsync's advanced possibilities, or find to fine-tune what you want to copy (perhaps with pax -rw -pe...)

share|improve this answer

There is an --after-date option and an --newer-mtime option,
but, I can recall using them for archiving, not extracting.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.