<<< Date Index >>>     <<< Thread Index >>>

Re: how to use tar



On Sun, Jan 18, 2004 at 12:24:41PM EST, Spiro Trikaliotis wrote:
> * On Sun, Jan 18, 2004 at 04:46:02PM +0100 Michael Tatge wrote:

> > tell tar to not modify atime. tar --atime-preserve
> >
> > HTH,
> 
> Just tested it, it works as expected. Thank you.
> 
> Anyway, just out of curiosity: If there would not be that option for
> tar, how could I achieve this?

The basic idea is to stat(2) the file and store its atime and mtime.
Then, you do whatever you want (which may modify the atime and/or mtime),
and then utime(2) to restore the atime and/or mtime from memory.

Another cool little option for a shell script is:
touch -r $file $file.atime
do_stuff $file
touch -r $file.atime $file
rm -f $file.atime

Enjoy,
 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpS79VCXPg1e.pgp
Description: PGP signature