*BSD News Article 59582


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.bhp.com.au!mel.dit.csiro.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!newsfeed.internetmci.com!in1.uu.net!twwells!bill
From: bill@twwells.com (T. William Wells)
Subject: Re: format for tar date argument?
Organization: None, Mt. Laurel, NJ
Message-ID: <DL54Ms.G6u@twwells.com>
References: <4ccm5m$27f@osprey.unf.edu> <4d6p9j$h7c@uriah.heep.sax.de>
Date: Sat, 13 Jan 1996 22:18:28 GMT
Lines: 27

In article <4d6p9j$h7c@uriah.heep.sax.de>,
J Wunsch <joerg_wunsch@uriah.heep.sax.de> wrote:
: caddy@osprey.unf.edu (Cliff Addy) writes:
: > I need to tar a directory tree with only the files modified in the last
: > hour.  I can't figure out the format of the date argument to tar to do
: > this.  I've looked at the man page and it doesn't explain it.  I've also
: > tried formats from several other commands (e.g. date) and no joy.
:
: Not for tar, but for cpio, one of the possible ways is:
:
: touch -t MMDDhhss /tmp/reference
:
: with MMDDhhss being the reference time, and then
:
: find /dir -newer /tmp/reference -print | cpio -o -Hcrc > /path/archive.cpio
:
: (You could even supply ``-Hustar'' to have cpio generating a tar
: archive.)

One thing to watch out for: cpio generates the file header with
the file size as of (about) when it opens the file and then writes
whatever the data is in the file. If the file changes in size
after it has been opened, the amount of data in the header will
not agree with the amount of data in the cpio archive. The result
is a corrupted archive....

This is arguably a bug. Or a misuse of cpio.