mtime and directories...

lists at battleface.com lists at battleface.com
Tue Nov 18 15:59:21 PST 2003


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



More information about the freebsd-hackers mailing list