On Oct 14, 2011, at 11:37 AM, Elliot Wilen wrote: > > Frank's idea seems to be valid, though: why not compare the mtimes of > directories and skip comparing the mtimes & sizes of files in those > directories which haven't changed? > > Note 1: It looks like you'd still have to compare subdirs even if their > parent dirs don't have a change in mtime. > > Note 2: Frank mentioned ctime but I think mtime is what you need to look at.
About this, mtime on a directory doesn't change if only the content of a file within the directory changes. I was fooled by the fact that I was modifying a file (changing a single character) using vi. However, vi is actually writing a new file when it saves. E.g. % ls -i tmp 2669792 tmp.txt ls -ld tmp drwxr-xr-x 3 myname staff 102 Oct 14 13:24 tmp % echo hello >> tmp/tmp.txt % ls -i tmp 2669792 tmp.txt % ls -ld tmp drwxr-xr-x 3 myname staff 102 Oct 14 13:24 tmp The last two commands confirm that tmp/tmp.txt is still the same file (and tail will show the appended "hello"), but the mtime of tmp/ hasn't changed. So just comparing the mtime on directories to decide if their contents' mtimes need to be compared isn't going to work. --Elliot Wilen -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html