Re: Modification dates of folders are inaccurate



In article <cJZuj.42850$C61.43@edtnps89>,
Robert Montgomery <info-block@xxxxxxxxxxxxxxxxx> wrote:

Tom Stiller wrote:
In article <s5Yuj.42797$C61.13400@edtnps89>,
Robert Montgomery <info-block@xxxxxxxxxxxxxxxxx> wrote:

The folders on my Imac have the same "Date Modified" as the
corresponding, duplicated folders on my external drives.

But when I examine the contents of the folders on both the Imac and the
external drives, some of the contents of some of the folders on my Imac
have more recent modification dates than the corresponding contents of
the corresponding folders on my external drives.

How can I get the folders on my Imac to accurately show the modification
dates of the contents of those folders?


Change the content of the folders. Changing the content of a file
within a folder doesn't change the folder's content.

I don't understand. This sounds like a paradox.

If you put a *** of paper into a file folder, or take the *** of
paper out of the file folder, the contents of the file folder certainly
changes.

How could it be ­ or why WOULD it be ­ any different on a computer?

Actually, the first thing that should be asked is what is your
ultimate goal. Maybe there is another way to solution to your
problem that does not depend on directory modification dates.

Now for some clarification on how directories work.

The the directory is structurally similar to an address book.

That is to say a directory contains a name and an internal file
system specific address for the file (called the inode number).

The file does not physically exist within the directory. So the
real world analogy of putting a *** of paper in a folder is not
really how it works internally. Internally you just put the name
you call the paper in the directory, and the file system records
the internal address of where it really put the paper.

In addition, the file does not know its parent directory. I'll
elaborate on this in a moment. But because the file does not know
its parent directory it can not tell the file system what
directory modification date to update.

The file system allows the use of hard links. Hard links allow
the file system to have multiple directories that point the the
exact same file (using the same or a different name). That is to
say, multiple address books can hold the address of the same
person, using names such as Mr Smith in one, "My Friend Fred" in
another, or "Tech Support Dude", etc.... Each new hard link
increments a reference count on the file so that the file system
knows not to really delete the file until that last hard link is
removed from the last directory.

This hard link feature is extremely useful for things like Time
Machine backups in Leopard. And if you have been saved by Time
Machine, then hard links are something you will grow to love even
if you didn't know they existed.

Because multiple directories can point to the same file, updating
the date of the parent directory becomes much more complicated,
because even if the file system had saved the path used to open
the file when it was modified, it would not know the path to all
the other directories which hard links to the file.

Now your assuming that looking at the parent directory is the way
to decide to backup the contents of a directory. There are other
ways, such as hooking into the file systems event notification
system and allowing the file system to tell a backup daemon when a
file has changed. The backup daemon can then do whatever it wants
with this information: save the list for the next backup, backup
right away, other... There are lots of existing backup utilities
that can be used to incrementally backup a file system besides
Time Machine. And if you want to work at the Unix level, then
there are lots of Unix commands that can aid in finding files to
be backed up (such as rsync).

Mac OS X does support multiple file systems for data disks, so
maybe you want to explore one of the other file systems such as
FAT, UnixFS, ZFS. And there is a project called MacFUSE that
allows even more file systems to be used on Mac OS X.

And of course you can write your own file system for Mac OS X and
have it do whatever you want. Then again, my day job is as a file
system developer, and getting those file system details just right
is a full time job for my entire group of 2 dozen developers :-)

Bob Harris
.