Re: How to check whether directory tree has changed?
Re: How to check whether directory tree has changed?
- Subject: Re: How to check whether directory tree has changed?
- From: Jens Alfke via Cocoa-dev <email@hidden>
- Date: Sat, 21 Dec 2019 10:43:11 -0800
> On Dec 21, 2019, at 10:18 AM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> Right. I was hoping there is an easy way to do this.
> Something like a recursive check sum over the whole directory tree that the
> OS might keep.
> I don't want to do a complete tree traversal every time the app launches.
I think you'll need to do it yourself. The FSEvents API isn't going to keep an
infinitely long history; it certainly won't go back to before the time the OS
booted.
You can shorten the traversal by keeping the mod date of every directory. Then
if the mod date hasn't changed, you don't need to scan the directory contents.
You can keep the data set smaller by keeping only a hash of the collected
names/mod dates/sizes of the files in each directory. But you do need to keep
the info for each subdirectory to do the above optimization.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden