[cs631apue] archive file check

Jan Schaumann jschauma at stevens.edu
Fri Oct 5 22:17:08 EDT 2018

Aubhik Mazumdar <amazumda at stevens.edu> wrote:
> I had 2 questions related to the archive files status 1 and 2.
> 1) What is meant by status 1 and status 2?

The archive bit is used for compatibility with certain file systems
(such as Windows' file system).  A file in archive state 1 has been
modified since the last full backup; an archive state 2 has been
modified since the last incremental backup.  The backup program clears
the archive flag when it backs up the file.

This bit has nothing to do with whether the file in question is itself
an "archive" (e.g. a .tar file).

> 2) What is the best way to check for this status?

You should use strmode(3) to convert the struct stat information into a
symbolic string.  It'll do the right thing for you and you don't have to
write a tedious if-then-else-then-else-then-else... block.


More information about the cs631apue mailing list