Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2003 18:59:17 -0500
From:      lists@battleface.com
To:        freebsd-hackers@freebsd.org
Subject:   mtime and directories...
Message-ID:  <383537BA-1A23-11D8-B220-000A95775140@battleface.com>

next in thread | raw e-mail | index | archive | help

Changing a file, of course, results in a change to its modification 
time. Am I correct in determining that the mtime of the enclosing 
directory is also updated?

The reason I'm asking this is because I need to be able to determine if 
any file has changed within a directory from a shell script, Perl, or 
Python. All I need to know is if at least one file has changed. I don't 
need to find all such files. [Sidelight: anyone know how, if possible, 
to stop find after finding one file? I can't figure this one out alone.]

My initial solution was to use 'find' to find any files newer than a 
marker file. However, I believe I've determined that the mtime of 
enclosing directories also changes to reflect the last file that was 
updated within its hierarchy. So, it makes sense that I simply check 
the directory that contains the marker file.

Thanks,

Alex



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?383537BA-1A23-11D8-B220-000A95775140>