tar --newer-mtime

Herta Van den Eynde herta.vandeneynde at gmail.com
Sun Nov 25 23:44:34 UTC 2007


On 25/11/2007, Johan Booysen <johan at matrix-data.co.uk> wrote:
> Dear all,
>
> Apologies if this is a silly question, but it's important enough for me
> to ask as a double-check:
>
> I want to do a once-off "incremental backup" of a server, in such a way
> that I create a tar archive of only data files that have been created or
> have been modified since a defined date.
>
> Will this do the trick, for example?
>
> tar -cvf incremental.tar --newer-mtime "24 Now 2007" *
>
> I.e. only tar up files that have been CREATED or MODIFIED since
> 24.11.2007...
>
> Thanks.
>
Linux doesn't record the creation date.  What you can get is:

atime = the last time the file was opened for read
mtime = the last time the file was closed after it was opened for write
ctime = the time the inode information was updated (e.g. as a result
of a chmod or chown

--newer-mtime will only tar files whose mtime has changed.  Better to
use --after-date, which will tar both files whose mtime or ctime has
changed.

Kind regards,

Herta




More information about the redhat-list mailing list