Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2003 00:38:15 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        David Bear <David.Bear@asu.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: getting the mdate of a file
Message-ID:  <20030716053815.GC68402@dan.emsphone.com>
In-Reply-To: <20030715214133.H18023@asu.edu>
References:  <20030715214133.H18023@asu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 15), David Bear said:
> I'd like to run tar using a data incremental.  For example, if I run
> tar today like this:
>   tar cvf /dev/nsa0 /home > home.catalog
> 
> I end up with a listing of all files tarr'ed in home.catalog.  Then
> the next day I'd like to run tar but only have tar select files that
> were changed since home.catalog was written.  Tar has --newer DATE
> option but I would like to set the DATE according to the last
> modified time of the home.catalog.
> 
> So, question 1 is how do I get the last mod date of a file?  

>From the tar infopage:

`--newer=DATE'
`--after-date=DATE'
`-N'
     When creating an archive, `tar' will only add files that have
     changed since DATE.  If DATE begins with `/' or `.', it is taken
     to be the name of a file whose last-modified time specifies the
     date.

> Question 2 is, is there a better way that I'm missing?

What I did when I used tar for backups was to use the
listed-incremental option, which tells tar to create a list of
filenames and timestamps, and on subsequent runs, only back up files
that differ from the listfile.  Worked very well.  To do a full backup,
just delete the listfile before running tar.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030716053815.GC68402>