From owner-freebsd-questions@FreeBSD.ORG  Tue Jul 15 22:38:17 2003
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Delivered-To: freebsd-questions@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4B3C237B404
	for <freebsd-questions@freebsd.org>;
	Tue, 15 Jul 2003 22:38:17 -0700 (PDT)
Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8033443FA3
	for <freebsd-questions@freebsd.org>;
	Tue, 15 Jul 2003 22:38:16 -0700 (PDT)
	(envelope-from dan@dan.emsphone.com)
Received: (from dan@localhost)
	by dan.emsphone.com (8.12.9/8.12.9) id h6G5cFnW040184;
	Wed, 16 Jul 2003 00:38:15 -0500 (CDT)
	(envelope-from dan)
Date: Wed, 16 Jul 2003 00:38:15 -0500
From: Dan Nelson <dnelson@allantgroup.com>
To: David Bear <David.Bear@asu.edu>
Message-ID: <20030716053815.GC68402@dan.emsphone.com>
References: <20030715214133.H18023@asu.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20030715214133.H18023@asu.edu>
X-OS: FreeBSD 5.1-CURRENT
X-message-flag: Outlook Error
User-Agent: Mutt/1.5.4i
cc: freebsd-questions@freebsd.org
Subject: Re: getting the mdate of a file
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Jul 2003 05:38:17 -0000

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